Skip to content

Commit 8867499

Browse files
committed
test(config): add integration test for droping index
1 parent 3b3b026 commit 8867499

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.weaviate.client6.v1.api.collections.ReferenceProperty;
2020
import io.weaviate.client6.v1.api.collections.Replication;
2121
import io.weaviate.client6.v1.api.collections.VectorConfig;
22+
import io.weaviate.client6.v1.api.collections.config.PropertyIndexType;
2223
import io.weaviate.client6.v1.api.collections.config.Shard;
2324
import io.weaviate.client6.v1.api.collections.config.ShardStatus;
2425
import io.weaviate.client6.v1.api.collections.generative.DummyGenerative;
@@ -328,4 +329,44 @@ public void test_objectTtl() throws IOException {
328329
.extracting(CollectionConfig::objectTtl).isNotNull()
329330
.returns(false, ObjectTtl::enabled);
330331
}
332+
333+
@Test
334+
public void test_dropPropertyIndex() throws IOException {
335+
Weaviate.Version.V136.orSkip();
336+
337+
// Arrange
338+
var nsThings = ns("Things");
339+
var things = client.collections.create(nsThings,
340+
c -> c.properties(
341+
Property.text("title", p -> p
342+
.indexFilterable(true)
343+
.indexSearchable(true)),
344+
Property.integer("size", p -> p
345+
.indexRangeFilters(true))));
346+
347+
var config = things.config.get();
348+
Assertions.assertThat(config).get()
349+
.extracting(CollectionConfig::properties, InstanceOfAssertFactories.list(Property.class))
350+
.allSatisfy(property -> {
351+
boolean isNumeric = property.dataTypes().contains(DataType.INT);
352+
353+
Assertions.assertThat(property)
354+
.returns(true, Property::indexFilterable)
355+
.returns(!isNumeric, Property::indexSearchable)
356+
.returns(isNumeric, Property::indexRangeFilters);
357+
});
358+
359+
things.config.dropPropertyIndex("title", PropertyIndexType.FILTERABLE);
360+
things.config.dropPropertyIndex("title", PropertyIndexType.SEARCHABLE);
361+
362+
things.config.dropPropertyIndex("size", PropertyIndexType.FILTERABLE);
363+
things.config.dropPropertyIndex("size", PropertyIndexType.RANGE_FILTERS);
364+
365+
Assertions.assertThat(config).get()
366+
.extracting(CollectionConfig::properties, InstanceOfAssertFactories.list(Property.class))
367+
.allSatisfy(property -> Assertions.assertThat(property)
368+
.returns(false, Property::indexFilterable)
369+
.returns(false, Property::indexSearchable)
370+
.returns(false, Property::indexRangeFilters));
371+
}
331372
}

0 commit comments

Comments
 (0)