Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Login to Docker Hub
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: docker/login-action@v2
Expand Down
2 changes: 1 addition & 1 deletion src/it/java/io/weaviate/containers/Weaviate.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public WeaviateClient getNewClient(Function<Config.Custom, ObjectBuilder<Config>
.grpcHost(host)
.httpPort(getMappedPort(8080))
.grpcPort(getMappedPort(50051)));
return WeaviateClient.custom(customFn);
return WeaviateClient.connectToCustom(customFn);
}

public static Weaviate createDefault() {
Expand Down
4 changes: 2 additions & 2 deletions src/it/java/io/weaviate/integration/AggregationITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import io.weaviate.ConcurrentTest;
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.Vectorizers;
import io.weaviate.client6.v1.api.collections.VectorConfig;
import io.weaviate.client6.v1.api.collections.Vectors;
import io.weaviate.client6.v1.api.collections.aggregate.Aggregate;
import io.weaviate.client6.v1.api.collections.aggregate.AggregateResponseGroup;
Expand All @@ -35,7 +35,7 @@ public static void beforeAll() throws IOException {
.properties(
Property.text("category"),
Property.integer("price"))
.vectors(Vectorizers.selfProvided()));
.vectorConfig(VectorConfig.selfProvided()));

var things = client.collections.use(COLLECTION);
for (var category : List.of("Shoes", "Hat", "Jacket")) {
Expand Down
12 changes: 6 additions & 6 deletions src/it/java/io/weaviate/integration/CollectionsITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import io.weaviate.client6.v1.api.collections.CollectionConfig;
import io.weaviate.client6.v1.api.collections.InvertedIndex;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.ReferenceProperty;
import io.weaviate.client6.v1.api.collections.Replication;
import io.weaviate.client6.v1.api.collections.Vectorizer;
import io.weaviate.client6.v1.api.collections.Vectorizers;
import io.weaviate.client6.v1.api.collections.VectorConfig;
import io.weaviate.client6.v1.api.collections.config.Shard;
import io.weaviate.client6.v1.api.collections.config.ShardStatus;
import io.weaviate.client6.v1.api.collections.vectorindex.Hnsw;
Expand All @@ -30,18 +30,18 @@ public void testCreateGetDelete() throws IOException {
client.collections.create(collectionName,
col -> col
.properties(Property.text("username"), Property.integer("age"))
.vectors(Vectorizers.selfProvided()));
.vectorConfig(VectorConfig.selfProvided()));

var thingsCollection = client.collections.getConfig(collectionName);

Assertions.assertThat(thingsCollection).get()
.hasFieldOrPropertyWithValue("collectionName", collectionName)
.extracting(CollectionConfig::vectors, InstanceOfAssertFactories.map(String.class, Vectorizer.class))
.extracting(CollectionConfig::vectors, InstanceOfAssertFactories.map(String.class, VectorConfig.class))
.as("default vector").extractingByKey("default")
.satisfies(defaultVector -> {
Assertions.assertThat(defaultVector)
.as("has none vectorizer").isInstanceOf(SelfProvidedVectorizer.class);
Assertions.assertThat(defaultVector).extracting(Vectorizer::vectorIndex)
Assertions.assertThat(defaultVector).extracting(VectorConfig::vectorIndex)
.isInstanceOf(Hnsw.class);
});

Expand All @@ -59,7 +59,7 @@ public void testCrossReferences() throws IOException {
// Act: Create Things collection with owner -> owners
var nsThings = ns("Things");
client.collections.create(nsThings,
col -> col.references(Property.reference("ownedBy", nsOwners)));
col -> col.references(ReferenceProperty.to("ownedBy", nsOwners)));
var things = client.collections.use(nsThings);

// Assert: Things --ownedBy-> Owners
Expand Down
15 changes: 8 additions & 7 deletions src/it/java/io/weaviate/integration/DataITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import io.weaviate.client6.v1.api.WeaviateApiException;
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.Vectorizers;
import io.weaviate.client6.v1.api.collections.ReferenceProperty;
import io.weaviate.client6.v1.api.collections.VectorConfig;
import io.weaviate.client6.v1.api.collections.Vectors;
import io.weaviate.client6.v1.api.collections.WeaviateObject;
import io.weaviate.client6.v1.api.collections.data.BatchReference;
Expand Down Expand Up @@ -116,8 +117,8 @@ private static void createTestCollections() throws IOException {
Property.text("name"),
Property.integer("age"))
.references(
Property.reference("hasAwards", awardsGrammy, awardsOscar))
.vectors(Vectorizers.selfProvided(VECTOR_INDEX)));
ReferenceProperty.to("hasAwards", awardsGrammy, awardsOscar))
.vectorConfig(VectorConfig.selfProvided(VECTOR_INDEX)));
}

@Test
Expand All @@ -128,7 +129,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
client.collections.create(nsPersons,
collection -> collection
.properties(Property.text("name"))
.references(Property.reference("hasFriend", nsPersons)));
.references(ReferenceProperty.to("hasFriend", nsPersons)));

var persons = client.collections.use(nsPersons);
var john = persons.data.insert(Map.of("name", "john"));
Expand Down Expand Up @@ -232,8 +233,8 @@ public void testUpdate() throws IOException {
client.collections.create(nsBooks,
collection -> collection
.properties(Property.text("title"), Property.integer("year"))
.references(Property.reference("writtenBy", nsAuthors))
.vectors(Vectorizers.selfProvided()));
.references(ReferenceProperty.to("writtenBy", nsAuthors))
.vectorConfig(VectorConfig.selfProvided()));

var authors = client.collections.use(nsAuthors);
var walter = authors.data.insert(Map.of("name", "walter scott"));
Expand Down Expand Up @@ -364,7 +365,7 @@ public void testReferenceAddMany() throws IOException {

client.collections.create(nsAirports);
client.collections.create(nsCities, c -> c
.references(Property.reference("hasAirports", nsAirports)));
.references(ReferenceProperty.to("hasAirports", nsAirports)));

var airports = client.collections.use(nsAirports);
var cities = client.collections.use(nsCities);
Expand Down
6 changes: 3 additions & 3 deletions src/it/java/io/weaviate/integration/ReferencesITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testReferences() throws IOException {
Property.text("name"),
Property.integer("age"))
.references(
Property.reference("hasAwards", nsGrammy, nsOscar)));
ReferenceProperty.to("hasAwards", nsGrammy, nsOscar)));

var artists = client.collections.use(nsArtists);
var grammies = client.collections.use(nsGrammy);
Expand Down Expand Up @@ -129,15 +129,15 @@ public void testNestedReferences() throws IOException {
// Act: create Artists collection with hasAwards reference
client.collections.create(nsGrammy,
col -> col
.references(Property.reference("presentedBy", nsAcademy)));
.references(ReferenceProperty.to("presentedBy", nsAcademy)));

client.collections.create(nsArtists,
col -> col
.properties(
Property.text("name"),
Property.integer("age"))
.references(
Property.reference("hasAwards", nsGrammy)));
ReferenceProperty.to("hasAwards", nsGrammy)));

var artists = client.collections.use(nsArtists);
var grammies = client.collections.use(nsGrammy);
Expand Down
27 changes: 14 additions & 13 deletions src/it/java/io/weaviate/integration/SearchITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import io.weaviate.client6.v1.api.WeaviateApiException;
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.Vectorizers;
import io.weaviate.client6.v1.api.collections.ReferenceProperty;
import io.weaviate.client6.v1.api.collections.VectorConfig;
import io.weaviate.client6.v1.api.collections.Vectors;
import io.weaviate.client6.v1.api.collections.WeaviateMetadata;
import io.weaviate.client6.v1.api.collections.WeaviateObject;
Expand Down Expand Up @@ -133,7 +134,7 @@ private static Map<String, float[]> populateTest(int n) throws IOException {
private static void createTestCollection() throws IOException {
client.collections.create(COLLECTION, cfg -> cfg
.properties(Property.text("category"))
.vectors(Vectorizers.selfProvided(VECTOR_INDEX)));
.vectorConfig(VectorConfig.selfProvided(VECTOR_INDEX)));
}

@Test
Expand All @@ -142,7 +143,7 @@ public void testNearText() throws IOException {
client.collections.create(nsSongs,
col -> col
.properties(Property.text("title"))
.vectors(Vectorizers.text2vecContextionary()));
.vectorConfig(VectorConfig.text2vecContextionary()));

var songs = client.collections.use(nsSongs);
var submarine = songs.data.insert(Map.of("title", "Yellow Submarine"));
Expand All @@ -164,13 +165,13 @@ public void testNearText() throws IOException {

@Test
public void testNearText_groupBy() throws IOException {
var vectorizer = Vectorizers.text2vecContextionary();
var vectorizer = VectorConfig.text2vecContextionary();

var nsArtists = ns("Artists");
client.collections.create(nsArtists,
col -> col
.properties(Property.text("name"))
.vectors(vectorizer));
.vectorConfig(vectorizer));

var artists = client.collections.use(nsArtists);
var beatles = artists.data.insert(Map.of("name", "Beatles"));
Expand All @@ -180,8 +181,8 @@ public void testNearText_groupBy() throws IOException {
client.collections.create(nsSongs,
col -> col
.properties(Property.text("title"))
.references(Property.reference("performedBy", nsArtists))
.vectors(vectorizer));
.references(ReferenceProperty.to("performedBy", nsArtists))
.vectorConfig(vectorizer));

var songs = client.collections.use(nsSongs);
songs.data.insert(Map.of("title", "Yellow Submarine"),
Expand All @@ -208,7 +209,7 @@ public void testNearImage() throws IOException {
.properties(
Property.text("breed"),
Property.blob("img"))
.vectors(Vectorizers.img2vecNeural(
.vectorConfig(VectorConfig.img2vecNeural(
i2v -> i2v.imageFields("img"))));

var cats = client.collections.use(nsCats);
Expand Down Expand Up @@ -390,7 +391,7 @@ public void testNearObject() throws IOException {
client.collections.create(nsAnimals,
collection -> collection
.properties(Property.text("kind"))
.vectors(Vectorizers.text2vecContextionary()));
.vectorConfig(VectorConfig.text2vecContextionary()));

var animals = client.collections.use(nsAnimals);

Expand Down Expand Up @@ -419,7 +420,7 @@ public void testHybrid() throws IOException {
client.collections.create(nsHobbies,
collection -> collection
.properties(Property.text("name"), Property.text("description"))
.vectors(Vectorizers.text2vecContextionary()));
.vectorConfig(VectorConfig.text2vecContextionary()));

var hobbies = client.collections.use(nsHobbies);

Expand Down Expand Up @@ -452,7 +453,7 @@ public void testBadRequest() throws IOException {
client.collections.create(nsThings,
collection -> collection
.properties(Property.text("name"))
.vectors(Vectorizers.text2vecContextionary()));
.vectorConfig(VectorConfig.text2vecContextionary()));

var things = client.collections.use(nsThings);
var balloon = things.data.insert(Map.of("name", "balloon"));
Expand All @@ -469,7 +470,7 @@ public void testBadRequest_async() throws Throwable {
async.collections.create(nsThings,
collection -> collection
.properties(Property.text("name"))
.vectors(Vectorizers.text2vecContextionary()))
.vectorConfig(VectorConfig.text2vecContextionary()))
.join();

var things = async.collections.use(nsThings);
Expand All @@ -490,7 +491,7 @@ public void testMetadataAll() throws IOException {
client.collections.create(nsThings,
c -> c
.properties(Property.text("name"))
.vectors(Vectorizers.text2vecContextionary(
.vectorConfig(VectorConfig.text2vecContextionary(
t2v -> t2v.sourceProperties("name"))));

var things = client.collections.use(nsThings);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/weaviate/client6/v1/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static class Local extends Builder<Local> {
public Local() {
scheme("http");
host("localhost");
httpPort(8080);
port(8080);
grpcPort(50051);
}

Expand All @@ -200,7 +200,7 @@ public Local host(String host) {
}

/** Override default HTTP port. */
public Local httpPort(int port) {
public Local port(int port) {
this.httpPort = port;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public record InstanceMetadata(
@SerializedName("hostname") String hostName,
@SerializedName("version") String version,
@SerializedName("modules") Map<String, Object> modules,
@SerializedName("grpcMaxMessageSize") Long grpcMaxMessageSize) {
@SerializedName("grpcMaxMessageSize") Integer grpcMaxMessageSize) {
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.weaviate.client6.v1.api;

/**
* Exception class thrown by client API message when the request's reached the
* server, but the operation did not complete successfully either either due to
* a bad request or a server error.
* Exception class thrown by client when the request had reached the
* server, but the operation did not complete successfully either
* due to a bad request or a server error.
*/
public class WeaviateApiException extends WeaviateException {
private final String errorMessage;
Expand Down
Loading