|
20 | 20 | import io.weaviate.client6.v1.api.collections.Replication; |
21 | 21 | import io.weaviate.client6.v1.api.collections.Replication.AsyncReplicationConfig; |
22 | 22 | import io.weaviate.client6.v1.api.collections.VectorConfig; |
| 23 | +import io.weaviate.client6.v1.api.collections.config.PropertyIndexType; |
23 | 24 | import io.weaviate.client6.v1.api.collections.config.Shard; |
24 | 25 | import io.weaviate.client6.v1.api.collections.config.ShardStatus; |
25 | 26 | import io.weaviate.client6.v1.api.collections.generative.DummyGenerative; |
@@ -330,6 +331,47 @@ public void test_objectTtl() throws IOException { |
330 | 331 | .returns(false, ObjectTtl::enabled); |
331 | 332 | } |
332 | 333 |
|
| 334 | + @Test |
| 335 | + public void test_dropPropertyIndex() throws IOException { |
| 336 | + Weaviate.Version.V136.orSkip(); |
| 337 | + |
| 338 | + // Arrange |
| 339 | + var nsThings = ns("Things"); |
| 340 | + var things = client.collections.create(nsThings, |
| 341 | + c -> c.properties( |
| 342 | + Property.text("title", p -> p |
| 343 | + .indexFilterable(true) |
| 344 | + .indexSearchable(true)), |
| 345 | + Property.integer("size", p -> p |
| 346 | + .indexRangeFilters(true)))); |
| 347 | + |
| 348 | + var config = things.config.get(); |
| 349 | + Assertions.assertThat(config).get() |
| 350 | + .extracting(CollectionConfig::properties, InstanceOfAssertFactories.list(Property.class)) |
| 351 | + .allSatisfy(property -> { |
| 352 | + boolean isNumeric = property.dataTypes().contains(DataType.INT); |
| 353 | + |
| 354 | + Assertions.assertThat(property) |
| 355 | + .returns(true, Property::indexFilterable) |
| 356 | + .returns(!isNumeric, Property::indexSearchable) |
| 357 | + .returns(isNumeric, Property::indexRangeFilters); |
| 358 | + }); |
| 359 | + |
| 360 | + things.config.dropPropertyIndex("title", PropertyIndexType.FILTERABLE); |
| 361 | + things.config.dropPropertyIndex("title", PropertyIndexType.SEARCHABLE); |
| 362 | + |
| 363 | + things.config.dropPropertyIndex("size", PropertyIndexType.FILTERABLE); |
| 364 | + things.config.dropPropertyIndex("size", PropertyIndexType.RANGE_FILTERS); |
| 365 | + |
| 366 | + config = things.config.get(); |
| 367 | + Assertions.assertThat(config).get() |
| 368 | + .extracting(CollectionConfig::properties, InstanceOfAssertFactories.list(Property.class)) |
| 369 | + .allSatisfy(property -> Assertions.assertThat(property) |
| 370 | + .returns(false, Property::indexFilterable) |
| 371 | + .returns(false, Property::indexSearchable) |
| 372 | + .returns(false, Property::indexRangeFilters)); |
| 373 | + } |
| 374 | + |
333 | 375 | @Test |
334 | 376 | public void test_asyncReplicationConfig() throws IOException { |
335 | 377 | Weaviate.Version.latest().orSkip(); |
|
0 commit comments