Skip to content

Commit 2e96499

Browse files
committed
Merge branch 'v6' into rename-filters
2 parents a085cf9 + 12f5388 commit 2e96499

36 files changed

+270
-253
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ record Artist(String firstName, String lastName, int age) {};
701701

702702
record Song(String title, Artist artist) {};
703703

704-
var song1 = songs.query.byId(
704+
var song1 = songs.query.fetchObjectById(
705705
uuid1,
706706
song -> song.returnReferences(QueryReference.single("artist"))
707707
);

src/it/java/io/weaviate/integration/DataITest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testCreateGetDelete() throws IOException {
5252
.uuid(id)
5353
.vectors(Vectors.of(VECTOR_INDEX, vector)));
5454

55-
var object = artists.query.byId(id, query -> query
55+
var object = artists.query.fetchObjectById(id, query -> query
5656
.returnProperties("name")
5757
.returnMetadata(
5858
MetadataField.VECTOR,
@@ -99,7 +99,7 @@ public void testBlobData() throws IOException {
9999
"breed", "ragdoll",
100100
"img", ragdollPng));
101101

102-
var got = cats.query.byId(ragdoll.metadata().uuid(),
102+
var got = cats.query.fetchObjectById(ragdoll.metadata().uuid(),
103103
cat -> cat.returnProperties("img"));
104104

105105
Assertions.assertThat(got).get()
@@ -145,7 +145,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
145145
Reference.object(albie));
146146

147147
// Assert
148-
var johnWithFriends = persons.query.byId(john.metadata().uuid(),
148+
var johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(),
149149
query -> query.returnReferences(
150150
QueryReference.single("hasFriend",
151151
friend -> friend.returnProperties("name"))));
@@ -165,7 +165,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
165165
"hasFriend",
166166
Reference.object(barbara));
167167

168-
johnWithFriends = persons.query.byId(john.metadata().uuid(),
168+
johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(),
169169
query -> query.returnReferences(
170170
QueryReference.single("hasFriend",
171171
friend -> friend.returnProperties("name"))));
@@ -185,7 +185,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
185185
Reference.object(barbara));
186186

187187
// Assert
188-
johnWithFriends = persons.query.byId(john.metadata().uuid(),
188+
johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(),
189189
query -> query.returnReferences(
190190
QueryReference.single("hasFriend")));
191191

@@ -214,7 +214,7 @@ public void testReplace() throws IOException {
214214
replace -> replace.properties(Map.of("year", 1819)));
215215

216216
// Assert
217-
var replacedIvanhoe = books.query.byId(ivanhoe.metadata().uuid());
217+
var replacedIvanhoe = books.query.fetchObjectById(ivanhoe.metadata().uuid());
218218

219219
Assertions.assertThat(replacedIvanhoe).get()
220220
.as("has ONLY year property")
@@ -258,7 +258,7 @@ public void testUpdate() throws IOException {
258258
.vectors(Vectors.of(vector)));
259259

260260
// Assert
261-
var updIvanhoe = books.query.byId(
261+
var updIvanhoe = books.query.fetchObjectById(
262262
ivanhoe.metadata().uuid(),
263263
query -> query
264264
.includeVector()
@@ -387,7 +387,7 @@ public void testReferenceAddMany() throws IOException {
387387
// Assert
388388
Assertions.assertThat(response.errors()).isEmpty();
389389

390-
var goodburgAirports = cities.query.byId(goodburg.metadata().uuid(),
390+
var goodburgAirports = cities.query.fetchObjectById(goodburg.metadata().uuid(),
391391
city -> city.returnReferences(
392392
QueryReference.single("hasAirports")));
393393

@@ -469,7 +469,7 @@ public void testDataTypes() throws IOException {
469469

470470
// Act
471471
var object = types.data.insert(want);
472-
var got = types.query.byId(object.uuid()); // return all properties
472+
var got = types.query.fetchObjectById(object.uuid()); // return all properties
473473

474474
// Assert
475475
Assertions.assertThat(got).get()

src/it/java/io/weaviate/integration/ORMITest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void test_insertAndQuery() throws Exception {
239239
var inserted = things.data.insert(thing);
240240

241241
// Assert
242-
var response = things.query.byId(inserted.uuid());
242+
var response = things.query.fetchObjectById(inserted.uuid());
243243
var got = Assertions.assertThat(response).get().actual();
244244

245245
Assertions.assertThat(got.properties())
@@ -353,7 +353,7 @@ public void test_partialScan() throws IOException {
353353
null));
354354

355355
// Act: return subset of the properties
356-
var got = songs.query.byId(dystopia.uuid(),
356+
var got = songs.query.fetchObjectById(dystopia.uuid(),
357357
q -> q.returnProperties("title", "hasAward"));
358358

359359
// Assert

src/it/java/io/weaviate/integration/ReferencesITest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void testReferences() throws IOException {
9191
.extracting(ReferenceProperty::dataTypes, InstanceOfAssertFactories.list(String.class))
9292
.containsOnly(nsMovies);
9393

94-
var gotAlex = artists.query.byId(alex.metadata().uuid(),
94+
var gotAlex = artists.query.fetchObjectById(alex.metadata().uuid(),
9595
opt -> opt.returnReferences(
9696
QueryReference.multi("hasAwards", nsOscar),
9797
QueryReference.multi("hasAwards", nsGrammy)));
@@ -155,7 +155,7 @@ public void testNestedReferences() throws IOException {
155155
.reference("hasAwards", Reference.objects(grammy_1)));
156156

157157
// Assert: fetch nested references
158-
var gotAlex = artists.query.byId(alex.metadata().uuid(),
158+
var gotAlex = artists.query.fetchObjectById(alex.metadata().uuid(),
159159
opt -> opt.returnReferences(
160160
QueryReference.single("hasAwards",
161161
ref -> ref

src/it/java/io/weaviate/integration/SearchITest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ public void test_includeVectors() throws IOException {
478478
Vectors.of("v3", new float[] { 7, 8, 9 })));
479479

480480
// Act
481-
var got = things.query.byId(
481+
var got = things.query.fetchObjectById(
482482
thing_1.uuid(),
483483
q -> q.includeVector("v1", "v2"));
484484

@@ -597,7 +597,7 @@ public void testGenerative_bm25() throws IOException {
597597
// Act
598598
var french = things.generate.bm25(
599599
"fork",
600-
bm25 -> bm25.queryProperties("title").limit(2),
600+
bm25 -> bm25.queryProperties("title").limit(2).includeVector(),
601601
generate -> generate
602602
.singlePrompt("translate to French")
603603
.groupedTask("count letters R"));
@@ -606,12 +606,18 @@ public void testGenerative_bm25() throws IOException {
606606
Assertions.assertThat(french.objects())
607607
.as("individual results")
608608
.hasSize(2)
609-
.extracting(GenerativeObject::generated)
609+
.allSatisfy(obj -> {
610+
Assertions.assertThat(obj).as("uuid shorthand")
611+
.returns(obj.uuid(), GenerativeObject::uuid);
612+
Assertions.assertThat(obj).as("vectors shorthand")
613+
.returns(obj.vectors(), GenerativeObject::vectors);
614+
})
615+
.extracting(GenerativeObject::generative)
610616
.allSatisfy(generated -> {
611617
Assertions.assertThat(generated.text()).isNotBlank();
612618
});
613619

614-
Assertions.assertThat(french.generated())
620+
Assertions.assertThat(french.generative())
615621
.as("summary")
616622
.extracting(TaskOutput::text, InstanceOfAssertFactories.STRING)
617623
.isNotBlank();
@@ -655,14 +661,14 @@ public void testGenerative_bm25_groupBy() throws IOException {
655661
.describedAs("objects in group %s", groupName)
656662
.hasSize(1);
657663

658-
Assertions.assertThat(group.generated())
664+
Assertions.assertThat(group.generative())
659665
.describedAs("summary group %s", groupName)
660666
.extracting(TaskOutput::text, InstanceOfAssertFactories.STRING)
661667
.isNotBlank();
662668

663669
});
664670

665-
Assertions.assertThat(french.generated())
671+
Assertions.assertThat(french.generative())
666672
.as("summary")
667673
.extracting(TaskOutput::text, InstanceOfAssertFactories.STRING)
668674
.isNotBlank();

src/main/java/io/weaviate/client6/v1/api/collections/Generative.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,23 @@ public static Generative awsBedrock(String region, String model,
118118
/**
119119
* Configure a default {@code generative-aws} module with Sagemaker integration.
120120
*
121-
* @param region AWS region.
122-
* @param baseUrl Base inference URL.
121+
* @param region AWS region.
122+
* @param endpoint Base inference URL.
123123
*/
124-
public static Generative awsSagemaker(String region, String baseUrl) {
125-
return AwsGenerative.sagemaker(region, baseUrl);
124+
public static Generative awsSagemaker(String region, String endpoint) {
125+
return AwsGenerative.sagemaker(region, endpoint);
126126
}
127127

128128
/**
129129
* Configure a {@code generative-aws} module with Sagemaker integration.
130130
*
131-
* @param region AWS region.
132-
* @param baseUrl Base inference URL.
133-
* @param fn Lambda expression for optional parameters.
131+
* @param region AWS region.
132+
* @param endpoint Base inference URL.
133+
* @param fn Lambda expression for optional parameters.
134134
*/
135-
public static Generative awsSagemaker(String region, String baseUrl,
135+
public static Generative awsSagemaker(String region, String endpoint,
136136
Function<AwsGenerative.SagemakerBuilder, ObjectBuilder<AwsGenerative>> fn) {
137-
return AwsGenerative.sagemaker(region, baseUrl, fn);
137+
return AwsGenerative.sagemaker(region, endpoint, fn);
138138
}
139139

140140
/** Configure a default {@code generative-cohere} module. */
@@ -154,21 +154,21 @@ public static Generative cohere(Function<CohereGenerative.Builder, ObjectBuilder
154154
/**
155155
* Configure a default {@code generative-databricks} module.
156156
*
157-
* @param baseURL Base URL for the generative service.
157+
* @param endpoint Base URL for the generative service.
158158
*/
159-
public static Generative databricks(String baseURL) {
160-
return DatabricksGenerative.of(baseURL);
159+
public static Generative databricks(String endpoint) {
160+
return DatabricksGenerative.of(endpoint);
161161
}
162162

163163
/**
164164
* Configure a {@code generative-databricks} module.
165165
*
166-
* @param baseURL Base URL for the generative service.
167-
* @param fn Lambda expression for optional parameters.
166+
* @param endpoint Base URL for the generative service.
167+
* @param fn Lambda expression for optional parameters.
168168
*/
169-
public static Generative databricks(String baseURL,
169+
public static Generative databricks(String endpoint,
170170
Function<DatabricksGenerative.Builder, ObjectBuilder<DatabricksGenerative>> fn) {
171-
return DatabricksGenerative.of(baseURL, fn);
171+
return DatabricksGenerative.of(endpoint, fn);
172172
}
173173

174174
/** Configure a default {@code generative-frienliai} module. */

src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -619,48 +619,48 @@ public static Map.Entry<String, VectorConfig> text2vecAwsBedrock(String vectorNa
619619
* Create a vector index with an {@code text2vec-aws} vectorizer with Sagemaker
620620
* integration.
621621
*
622-
* @param baseUrl Base URL of the inference service.
622+
* @param endpoint Base URL of the inference service.
623623
*/
624-
public static Map.Entry<String, VectorConfig> text2vecAwsSagemaker(String baseUrl) {
625-
return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, baseUrl);
624+
public static Map.Entry<String, VectorConfig> text2vecAwsSagemaker(String endpoint) {
625+
return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, endpoint);
626626
}
627627

628628
/**
629629
* Create a vector index with an {@code text2vec-aws} vectorizer with Sagemaker
630630
* integration.
631631
*
632-
* @param baseUrl Base URL of the inference service.
633-
* @param fn Lambda expression for optional parameters.
632+
* @param endpoint Base URL of the inference service.
633+
* @param fn Lambda expression for optional parameters.
634634
*/
635635
public static Map.Entry<String, VectorConfig> text2vecAwsSagemaker(
636-
String baseUrl,
636+
String endpoint,
637637
Function<Text2VecAwsVectorizer.SagemakerBuilder, ObjectBuilder<Text2VecAwsVectorizer>> fn) {
638-
return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, baseUrl, fn);
638+
return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, endpoint, fn);
639639
}
640640

641641
/**
642642
* Create a named vector index with an {@code text2vec-aws}
643643
* vectorizer with Sagemaker integration.
644644
*
645645
* @param vectorName Vector name.
646-
* @param baseUrl Base URL of the inference service.
646+
* @param endpoint Base URL of the inference service.
647647
*/
648-
public static Map.Entry<String, VectorConfig> text2vecAwsSagemaker(String vectorName, String baseUrl) {
649-
return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(baseUrl));
648+
public static Map.Entry<String, VectorConfig> text2vecAwsSagemaker(String vectorName, String endpoint) {
649+
return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(endpoint));
650650
}
651651

652652
/**
653653
* Create a named vector index with an {@code text2vec-aws}
654654
* vectorizer with Sagemaker integration.
655655
*
656656
* @param vectorName Vector name.
657-
* @param baseUrl Base URL of the inference service.
657+
* @param endpoint Base URL of the inference service.
658658
* @param fn Lambda expression for optional parameters.
659659
*/
660660
public static Map.Entry<String, VectorConfig> text2vecAwsSagemaker(String vectorName,
661-
String baseUrl,
661+
String endpoint,
662662
Function<Text2VecAwsVectorizer.SagemakerBuilder, ObjectBuilder<Text2VecAwsVectorizer>> fn) {
663-
return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(baseUrl, fn));
663+
return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(endpoint, fn));
664664
}
665665

666666
/**

src/main/java/io/weaviate/client6/v1/api/collections/WeaviateObject.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public record WeaviateObject<P, R, M extends WeaviateMetadata>(
2727
Map<String, List<R>> references,
2828
M metadata) {
2929

30-
/** Shorthand for accesing objects's UUID from metadata. */
30+
/** Shorthand for accessing objects's UUID from metadata. */
3131
public String uuid() {
3232
return metadata.uuid();
3333
}
3434

35-
/** Shorthand for accesing objects's vectors from metadata. */
35+
/** Shorthand for accessing objects's vectors from metadata. */
3636
public Vectors vectors() {
3737
return metadata.vectors();
3838
}

src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public WeaviateObject<PropertiesT, Object, ObjectMetadata> insert(InsertObjectRe
8080
}
8181

8282
public boolean exists(String uuid) {
83-
return this.query.byId(uuid).isPresent();
83+
return this.query.fetchObjectById(uuid).isPresent();
8484
}
8585

8686
public void update(String uuid,

src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClientAsync.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public CompletableFuture<InsertManyResponse> insertMany(InsertManyRequest<Proper
7777
}
7878

7979
public CompletableFuture<Boolean> exists(String uuid) {
80-
return this.query.byId(uuid).thenApply(Optional::isPresent);
80+
return this.query.fetchObjectById(uuid).thenApply(Optional::isPresent);
8181
}
8282

8383
public CompletableFuture<Void> update(String uuid,

0 commit comments

Comments
 (0)