Skip to content

Commit a534d9a

Browse files
committed
Merge branch 'v6' into v6-minimal-version
2 parents ecef35c + e410c07 commit a534d9a

72 files changed

Lines changed: 1590 additions & 1293 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To start using Weaviate Java Client add the dependency to `pom.xml`:
1515
<dependency>
1616
<groupId>io.weaviate</groupId>
1717
<artifactId>client6</artifactId>
18-
<version>6.0.0-M1</version>
18+
<version>6.0.0-M2</version>
1919
</dependency>
2020
```
2121

@@ -28,7 +28,7 @@ This ensures that all dynamically-loaded dependecies of `io.grpc` are resolved c
2828
<dependency>
2929
<groupId>io.weaviate</groupId>
3030
<artifactId>client6</artifactId>
31-
<version>6.0.0-M1</version>
31+
<version>6.0.0-M2</version>
3232
<classifier>all</classifier>
3333
</dependency>
3434
```
@@ -430,8 +430,8 @@ songs.query.hybrid(
430430
Objects can be filtered by property or reference values. In the latter case you need to pass the "path" to the property in the referenced collection.
431431

432432
```java
433-
.where(Where.property("year").gte(1969))
434-
.where(Where.reference("hasAwards", "GrammyAwards", "category").eq("New Artist"))
433+
.filters(Filter.property("year").gte(1969))
434+
.filters(Filter.reference("hasAwards", "GrammyAwards", "category").eq("New Artist"))
435435
```
436436

437437
Supported **comparison operators**:
@@ -451,15 +451,15 @@ Supported **comparison operators**:
451451
Comparison operators can be grouped using **logical operators** with arbitrarily deep nesting.
452452

453453
```java
454-
.where(
455-
Where.or(
456-
Where.and(
457-
Where.property("year").gt(2000),
458-
Where.property("year").lt(2017)
454+
.filters(
455+
Filter.or(
456+
Filter.and(
457+
Filter.property("year").gt(2000),
458+
Filter.property("year").lt(2017)
459459
),
460-
Where.or(
461-
Where.property("artist").like("Boys"),
462-
Where.property("genres").containsAny("#rock", "#rocknroll", "#grunge")
460+
Filter.or(
461+
Filter.property("artist").like("Boys"),
462+
Filter.property("genres").containsAny("#rock", "#rocknroll", "#grunge")
463463
)
464464
)
465465
)
@@ -471,23 +471,23 @@ Supported **logical operators**:
471471
- Or: `.or`
472472
- Not: `.not`
473473

474-
Operators passed in subsequent calls to `.where` are concatenated with the `.and` operartor.
474+
Operators passed in subsequent calls to `.filters` are concatenated with the `.and` operartor.
475475
These 3 calls are equivalent:
476476

477477
```java
478-
.where(Where.and(cond1, cond2))
479-
.where(cond1, cond2)
480-
.where(cond1).where(cond2)
478+
.filters(Filter.and(cond1, cond2))
479+
.filters(cond1, cond2)
480+
.filters(cond1).filters(cond2)
481481
```
482482

483-
To negate an operator, wrap it in `Where.not(...)` or use the negation shorthand.
483+
To negate an operator, wrap it in `Filter.not(...)` or use the negation shorthand.
484484

485485
```java
486-
Where.not(Where.property("title").like("summer"));
487-
Where.property("title").like("summer").not();
486+
Filter.not(Filter.property("title").like("summer"));
487+
Filter.property("title").like("summer").not();
488488
```
489489

490-
Passing `null` and and empty `Where[]` to any of the logical operators as well as to the `.where()` method is safe -- the empty operators will simply be ignored.
490+
Passing `null` and empty `Filter[]` to any of the logical operators as well as to the `.filters()` method is safe -- the empty operators will simply be ignored.
491491

492492

493493
#### Grouping results
@@ -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
);

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<connection>scm:git:git://github.com/weaviate/java-client.git</connection>
4343
<developerConnection>scm:git:ssh://github.com:weaviate/java-client.git</developerConnection>
4444
<url>https://github.com/weaviate/java-client/tree/main</url>
45-
<tag>6.0.0-M1</tag>
45+
<tag>6.0.0-M2</tag>
4646
</scm>
4747

4848
<properties>

src/it/java/io/weaviate/containers/Weaviate.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ public Builder withApiKeys(String... apiKeys) {
235235
return this;
236236
}
237237

238+
public Builder withGrpcMaxMessageSize(int bytes) {
239+
environment.put("GRPC_MAX_MESSAGE_SIZE", String.valueOf(bytes));
240+
return this;
241+
}
242+
238243
public Builder enableTelemetry(boolean enable) {
239244
environment.put("DISABLE_TELEMETRY", Boolean.toString(!enable));
240245
return this;

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ public void test_aliasLifecycle() throws IOException {
5555
.returns(nsColsonBaker, Alias::collection);
5656

5757
// Act: delete Bono alias
58-
client.alias.delete("Bono");
58+
var deleted = client.alias.delete("Bono");
59+
Assertions.assertThat(deleted).as("object was deleted").isTrue();
5960

60-
// Assert
61+
// Act: delete non-existent alias
62+
deleted = client.alias.delete("Bono");
63+
Assertions.assertThat(deleted).as("object wasn't deleted").isFalse();
6164
var paulHewsonAliases = client.alias.list(all -> all.collection(nsPaulHewson));
6265
Assertions.assertThat(paulHewsonAliases)
6366
.as("no aliases once Bono is deleted")

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import io.weaviate.client6.v1.api.collections.query.Metadata.MetadataField;
2929
import io.weaviate.client6.v1.api.collections.query.QueryMetadata;
3030
import io.weaviate.client6.v1.api.collections.query.QueryReference;
31-
import io.weaviate.client6.v1.api.collections.query.Where;
31+
import io.weaviate.client6.v1.api.collections.query.Filter;
3232
import io.weaviate.containers.Container;
3333

3434
public class DataITest extends ConcurrentTest {
@@ -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,
@@ -79,9 +79,16 @@ public void testCreateGetDelete() throws IOException {
7979
.as("lastUpdateTimeUnix").isNotNull();
8080
});
8181

82-
artists.data.delete(id);
82+
var deleted = artists.data.deleteById(id);
83+
Assertions.assertThat(deleted)
84+
.as("object was deleted").isTrue();
8385
Assertions.assertThat(artists.data.exists(id))
8486
.as("object not exists after deletion").isFalse();
87+
88+
deleted = artists.data.deleteById(id);
89+
// TODO: Change to isFalse() after fixed in Weaviate server
90+
Assertions.assertThat(deleted)
91+
.as("object wasn't deleted").isTrue();
8592
}
8693

8794
@Test
@@ -99,7 +106,7 @@ public void testBlobData() throws IOException {
99106
"breed", "ragdoll",
100107
"img", ragdollPng));
101108

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

105112
Assertions.assertThat(got).get()
@@ -145,7 +152,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
145152
Reference.object(albie));
146153

147154
// Assert
148-
var johnWithFriends = persons.query.byId(john.metadata().uuid(),
155+
var johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(),
149156
query -> query.returnReferences(
150157
QueryReference.single("hasFriend",
151158
friend -> friend.returnProperties("name"))));
@@ -165,7 +172,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
165172
"hasFriend",
166173
Reference.object(barbara));
167174

168-
johnWithFriends = persons.query.byId(john.metadata().uuid(),
175+
johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(),
169176
query -> query.returnReferences(
170177
QueryReference.single("hasFriend",
171178
friend -> friend.returnProperties("name"))));
@@ -185,7 +192,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
185192
Reference.object(barbara));
186193

187194
// Assert
188-
johnWithFriends = persons.query.byId(john.metadata().uuid(),
195+
johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(),
189196
query -> query.returnReferences(
190197
QueryReference.single("hasFriend")));
191198

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

216223
// Assert
217-
var replacedIvanhoe = books.query.byId(ivanhoe.metadata().uuid());
224+
var replacedIvanhoe = books.query.fetchObjectById(ivanhoe.metadata().uuid());
218225

219226
Assertions.assertThat(replacedIvanhoe).get()
220227
.as("has ONLY year property")
@@ -258,7 +265,7 @@ public void testUpdate() throws IOException {
258265
.vectors(Vectors.of(vector)));
259266

260267
// Assert
261-
var updIvanhoe = books.query.byId(
268+
var updIvanhoe = books.query.fetchObjectById(
262269
ivanhoe.metadata().uuid(),
263270
query -> query
264271
.includeVector()
@@ -303,7 +310,7 @@ public void testDeleteMany() throws IOException {
303310

304311
// Act (dry run)
305312
things.data.deleteMany(
306-
Where.property("last_used").gte(4),
313+
Filter.property("last_used").gte(4),
307314
opt -> opt.dryRun(true));
308315

309316
// Assert
@@ -312,7 +319,7 @@ public void testDeleteMany() throws IOException {
312319

313320
// Act (live run)
314321
var deleted = things.data.deleteMany(
315-
Where.property("last_used").gte(4),
322+
Filter.property("last_used").gte(4),
316323
opt -> opt.verbose(true));
317324

318325
// Assert
@@ -387,7 +394,7 @@ public void testReferenceAddMany() throws IOException {
387394
// Assert
388395
Assertions.assertThat(response.errors()).isEmpty();
389396

390-
var goodburgAirports = cities.query.byId(goodburg.metadata().uuid(),
397+
var goodburgAirports = cities.query.fetchObjectById(goodburg.metadata().uuid(),
391398
city -> city.returnReferences(
392399
QueryReference.single("hasAirports")));
393400

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

470477
// Act
471478
var object = types.data.insert(want);
472-
var got = types.query.byId(object.uuid()); // return all properties
479+
var got = types.query.fetchObjectById(object.uuid()); // return all properties
473480

474481
// Assert
475482
Assertions.assertThat(got).get()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ public void test_resourceOwnerPassword() throws Exception {
103103

104104
@Test
105105
public void test_clientCredentials() throws Exception {
106-
Assume.assumeTrue("OKTA_CLIENT_SECRET is not set", OKTA_CLIENT_SECRET != null && !OKTA_CLIENT_SECRET.isBlank());
106+
Assume.assumeTrue("OKTA_CLIENT_SECRET is not set", OKTA_CLIENT_SECRET != null && OKTA_CLIENT_SECRET.isBlank());
107107
Assume.assumeTrue("no internet connection", hasInternetConnection());
108108

109109
// Check norwal client credentials flow works.
110-
var cc = Authentication.clientCredentials(OKTA_CLIENT_ID, OKTA_CLIENT_SECRET, List.of());
110+
var cc = Authentication.clientCredentials(OKTA_CLIENT_SECRET, List.of());
111111
var auth = SpyTokenProvider.spyOn(cc);
112112
pingWeaviate(oktaContainer, auth);
113113
pingWeaviateAsync(oktaContainer, auth);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import io.weaviate.client6.v1.api.collections.annotations.Collection;
2222
import io.weaviate.client6.v1.api.collections.annotations.Property;
2323
import io.weaviate.client6.v1.api.collections.data.InsertManyResponse.InsertObject;
24-
import io.weaviate.client6.v1.api.collections.query.Where;
24+
import io.weaviate.client6.v1.api.collections.query.Filter;
2525
import io.weaviate.containers.Container;
2626

2727
public class ORMITest extends ConcurrentTest {
@@ -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())
@@ -318,7 +318,7 @@ public void test_insertManyAndQuery() throws Exception {
318318

319319
// Assert
320320
var uuids = inserted.responses().stream().map(InsertObject::uuid).toArray(String[]::new);
321-
var got = things.query.fetchObjects(q -> q.where(Where.uuid().containsAny(uuids)));
321+
var got = things.query.fetchObjects(q -> q.filters(Filter.uuid().containsAny(uuids)));
322322
Assertions.assertThat(got.objects())
323323
.hasSize(3)
324324
.usingRecursiveComparison(COMPARISON_CONFIG)
@@ -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/RbacITest.java

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,30 +218,54 @@ public void test_users_db() throws IOException {
218218
.extracting(Role::name)
219219
.doesNotContain(roleName);
220220

221-
client.users.db.activate(userId);
221+
var deactivated = client.users.db.deactivate(userId);
222+
Assertions.assertThat(deactivated)
223+
.as("user was deactivated")
224+
.isTrue();
225+
Assertions.assertThat(client.users.db.byName(userId)).get()
226+
.as("user is deactivated")
227+
.returns(false, DbUser::active);
228+
229+
deactivated = client.users.db.deactivate(userId);
230+
Assertions.assertThat(deactivated)
231+
.as("user was already deactivated")
232+
.isFalse();
233+
234+
var activated = client.users.db.activate(userId);
235+
Assertions.assertThat(activated)
236+
.as("user was activated")
237+
.isTrue();
222238
Assertions.assertThat(client.users.db.byName(userId)).get()
223239
.as("user is activated")
224240
.returns(true, DbUser::active);
225241

242+
activated = client.users.db.activate(userId);
243+
Assertions.assertThat(activated)
244+
.as("user was already active")
245+
.isFalse();
246+
226247
apiKey = client.users.db.rotateKey(userId);
227248
assertValidApiKey(apiKey);
228249

229-
client.users.db.deactivate(userId);
230-
Assertions.assertThat(client.users.db.byName(userId)).get()
231-
.as("user is deactivated")
232-
.returns(false, DbUser::active);
233-
234250
var all = client.users.db.list(users -> users.includeLastUsedAt(true));
235251
Assertions.assertThat(all)
236252
.as("list users include lastUsedTime ")
237253
.allMatch(user -> user.lastUsedAt() != null)
238254
.extracting(DbUser::id)
239255
.contains(userId, ADMIN_USER);
240256

241-
client.users.db.delete(userId);
257+
var deleted = client.users.db.delete(userId);
258+
Assertions.assertThat(deleted)
259+
.as("user was deleted")
260+
.isTrue();
242261
Assertions.assertThat(client.users.db.byName(userId))
243262
.as("user is deleted")
244263
.isEmpty();
264+
265+
deleted = client.users.db.delete(userId);
266+
Assertions.assertThat(deleted)
267+
.as("user was already deleted")
268+
.isFalse();
245269
}
246270

247271
@Test

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

0 commit comments

Comments
 (0)