Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ jobs:
strategy:
fail-fast: false
matrix:
WEAVIATE_VERSION: ["1.32.24", "1.33.11", "1.34.7", "1.35.2", "1.36.1"]
WEAVIATE_VERSION:
["1.32.24", "1.33.11", "1.34.7", "1.35.2", "1.36.9", "1.37.0-rc.0"]
steps:
- uses: actions/checkout@v4

Expand Down
3 changes: 2 additions & 1 deletion src/it/java/io/weaviate/containers/Weaviate.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public enum Version {
V133(1, 33, 11),
V134(1, 34, 7),
V135(1, 35, 2),
V136(1, 36, 1);
V136(1, 36, 9),
V137(1, 37, "0-rc.0");

public final SemanticVersion semver;

Expand Down
25 changes: 25 additions & 0 deletions src/it/java/io/weaviate/integration/CollectionsITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,31 @@ public void test_dropPropertyIndex() throws IOException {
.returns(false, Property::indexRangeFilters));
}

@Test
public void test_dropVectorIndex() throws IOException {
Weaviate.Version.V137.orSkip();

// Arrange
var nsThings = ns("Things");
var things = client.collections.create(nsThings,
c -> c.vectorConfig(VectorConfig.selfProvided("leaveme"), VectorConfig.selfProvided("dropme")));

var config = things.config.get();
Assertions.assertThat(config).get()
.extracting(CollectionConfig::vectors, InstanceOfAssertFactories.map(String.class, VectorConfig.class))
.hasSize(2)
.containsKey("dropme");

things.config.dropVectorIndex("dropme");

config = things.config.get();
Assertions.assertThat(config).get()
.extracting(CollectionConfig::vectors, InstanceOfAssertFactories.map(String.class, VectorConfig.class))
.hasSize(2)
.extractingByKey("dropme")
.returns(null, VectorConfig::vectorIndex); // A dropped index has not vectorIndex configuration.
}

@Test
public void test_asyncReplicationConfig() throws IOException {
Weaviate.Version.latest().orSkip();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,12 @@ public void write(JsonWriter out, VectorConfig value) throws IOException {
@Override
public VectorConfig read(JsonReader in) throws IOException {
var jsonObject = JsonParser.parseReader(in).getAsJsonObject();
var vectorIndexConfig = jsonObject.get("vectorIndexConfig").getAsJsonObject();
JsonObject vectorIndexConfig = new JsonObject();
if (jsonObject.has("vectorIndexConfig")) {
// If the vector index has been dropped it will still be present in the
// response, but won't contain "vectorIndexConfig" and "vectorIndexType" fields.
vectorIndexConfig = jsonObject.get("vectorIndexConfig").getAsJsonObject();
}

String quantizationKind = null;
for (var kind : new String[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,22 @@ public void write(JsonWriter out, VectorIndex value) throws IOException {
public VectorIndex read(JsonReader in) throws IOException {
var jsonObject = JsonParser.parseReader(in).getAsJsonObject();

var vectorIndexType = jsonObject.get("vectorIndexType");
if (vectorIndexType == null || vectorIndexType.isJsonNull()) {
// VectorConfig.CustomTypeAdapterFactory cannot provide this
// value for vector indexes that have been dropped.
return null;
}

var vectorIndexConfig = jsonObject.get("vectorIndexConfig");
if (vectorIndexConfig == null || vectorIndexConfig.isJsonNull()) {
// VectorConfig.CustomTypeAdapterFactory cannot provide this
// value for vector indexes that have been dropped.
return null;
}

VectorIndex.Kind kind;
var kindString = jsonObject.get("vectorIndexType").getAsString();
var kindString = vectorIndexType.getAsString();
try {
kind = VectorIndex.Kind.valueOfJson(kindString);
} catch (IllegalArgumentException e) {
Expand All @@ -150,7 +164,7 @@ public VectorIndex read(JsonReader in) throws IOException {
return null;
}

var config = jsonObject.get("vectorIndexConfig").getAsJsonObject();
var config = vectorIndexConfig.getAsJsonObject();
return adapter.fromJsonTree(config);
}
}.nullSafe();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.weaviate.client6.v1.api.collections.config;

import java.util.Collections;

import io.weaviate.client6.v1.internal.rest.Endpoint;
import io.weaviate.client6.v1.internal.rest.SimpleEndpoint;

public record DeleteVectorIndexRequest(String collectionName, String vectorName) {
public static final Endpoint<DeleteVectorIndexRequest, Void> _ENDPOINT = SimpleEndpoint.sideEffect(
request -> "DELETE",
request -> "/schema/" + request.collectionName + "/vectors/" + request.vectorName + "/index",
request -> Collections.emptyMap());
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public void dropPropertyIndex(String propertyName, PropertyIndexType indexType)
DeletePropertyIndexRequest._ENDPOINT);
}

public void dropVectorIndex(String vectorName) throws IOException {
this.restTransport.performRequest(
new DeleteVectorIndexRequest(collection.collectionName(), vectorName),
DeleteVectorIndexRequest._ENDPOINT);
}

public void addReference(String propertyName, String... dataTypes) throws IOException {
this.addProperty(ReferenceProperty.to(propertyName, dataTypes).toProperty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public CompletableFuture<Void> dropPropertyIndex(String propertyName, PropertyIn
DeletePropertyIndexRequest._ENDPOINT);
}

public CompletableFuture<Void> dropVectorIndex(String vectorName) throws IOException {
return this.restTransport.performRequestAsync(
new DeleteVectorIndexRequest(collection.collectionName(), vectorName),
DeleteVectorIndexRequest._ENDPOINT);
}

public CompletableFuture<Void> addReference(String name, String... dataTypes) throws IOException {
return this.addProperty(ReferenceProperty.to(name, dataTypes).toProperty());
}
Expand Down
Loading