Skip to content

Commit 0f23f03

Browse files
committed
feat(config): add drop property index operation
1 parent 5ecb7e5 commit 0f23f03

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.weaviate.client6.v1.api.collections.config;
2+
3+
import java.util.Collections;
4+
5+
import io.weaviate.client6.v1.internal.rest.Endpoint;
6+
import io.weaviate.client6.v1.internal.rest.SimpleEndpoint;
7+
8+
public record DeletePropertyIndexRequest(String collectionName, String propertyName, PropertyIndexType indexType) {
9+
public static final Endpoint<DeletePropertyIndexRequest, Void> _ENDPOINT = SimpleEndpoint.sideEffect(
10+
request -> "DELETE",
11+
request -> "/schema/" + request.collectionName + "/properties/" + request.propertyName + "/index/"
12+
+ request.indexType.toString(),
13+
request -> Collections.emptyMap());
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.weaviate.client6.v1.api.collections.config;
2+
3+
public enum PropertyIndexType {
4+
FILTERABLE("filterable"),
5+
SEARCHABLE("searchable"),
6+
RANGE_FILTERS("rangeFilters");
7+
8+
private final String value;
9+
10+
private PropertyIndexType(String value) {
11+
this.value = value;
12+
}
13+
14+
public String toString() {
15+
return value;
16+
}
17+
}

src/main/java/io/weaviate/client6/v1/api/collections/config/WeaviateConfigClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public void addProperty(Property property) throws IOException {
5252
AddPropertyRequest._ENDPOINT);
5353
}
5454

55+
public void dropPropertyIndex(String propertyName, PropertyIndexType indexType) throws IOException {
56+
this.restTransport.performRequest(
57+
new DeletePropertyIndexRequest(collection.collectionName(), propertyName, indexType),
58+
DeletePropertyIndexRequest._ENDPOINT);
59+
}
60+
5561
public void addReference(String propertyName, String... dataTypes) throws IOException {
5662
this.addProperty(ReferenceProperty.to(propertyName, dataTypes).toProperty());
5763
}

src/main/java/io/weaviate/client6/v1/api/collections/config/WeaviateConfigClientAsync.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public CompletableFuture<Void> addProperty(Property property) throws IOException
5353
AddPropertyRequest._ENDPOINT);
5454
}
5555

56+
public CompletableFuture<Void> dropPropertyIndex(String propertyName, PropertyIndexType indexType) {
57+
return this.restTransport.performRequestAsync(
58+
new DeletePropertyIndexRequest(collection.collectionName(), propertyName, indexType),
59+
DeletePropertyIndexRequest._ENDPOINT);
60+
}
61+
5662
public CompletableFuture<Void> addReference(String name, String... dataTypes) throws IOException {
5763
return this.addProperty(ReferenceProperty.to(name, dataTypes).toProperty());
5864
}

0 commit comments

Comments
 (0)