Skip to content

Commit d4a4ef4

Browse files
committed
refactor: scope reindex type names to inverted indexes (#2098)
Renames the unreleased public types PropertyIndexType/State/Status/ Task/TaskStatus to InvertedIndexType/State/Status/Task/TaskStatus and PropertyIndexes/CollectionPropertyIndexes to PropertyInvertedIndexes/ CollectionInvertedIndexes, incl. private counterparts and parser names. The runtime reindex API only ever touches inverted indexes; a future vector reindex must not collide with these names. Method names, the released IndexName alias and the deliberately generic Reindex*Error exceptions are unchanged.
1 parent e65fa0b commit d4a4ef4

9 files changed

Lines changed: 177 additions & 177 deletions

File tree

integration/test_collection_config.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
_NamedVectorConfigCreate,
4242
_VectorizerConfigCreate,
4343
IndexName,
44-
PropertyIndexState,
45-
PropertyIndexTaskStatus,
44+
InvertedIndexState,
45+
InvertedIndexTaskStatus,
4646
)
4747
from weaviate.collections.classes.tenants import Tenant
4848
from weaviate.exceptions import (
@@ -2706,14 +2706,14 @@ def test_property_reindex_searchable_lifecycle(collection_factory: CollectionFac
27062706
"name", "searchable", tokenization=Tokenization.WORD, wait_for_completion=True
27072707
)
27082708
assert status.type == "searchable"
2709-
assert status.status == PropertyIndexState.READY
2709+
assert status.status == InvertedIndexState.READY
27102710
assert status.tokenization == Tokenization.WORD
27112711

27122712
# re-putting the matching configuration is a no-op
27132713
task = collection.config.update_property_index(
27142714
"name", "searchable", tokenization=Tokenization.WORD
27152715
)
2716-
assert task.status == PropertyIndexTaskStatus.NO_OP
2716+
assert task.status == InvertedIndexTaskStatus.NO_OP
27172717
assert task.task_id is None
27182718

27192719
# the status endpoint reports the index as ready
@@ -2726,18 +2726,18 @@ def test_property_reindex_searchable_lifecycle(collection_factory: CollectionFac
27262726
for index in prop.indexes
27272727
if index.type == "searchable"
27282728
)
2729-
assert entry.status == PropertyIndexState.READY
2729+
assert entry.status == InvertedIndexState.READY
27302730

27312731
# rebuild the index from scratch
27322732
status = collection.config.rebuild_property_index(
27332733
"name", "searchable", wait_for_completion=True
27342734
)
27352735
assert status.type == "searchable"
2736-
assert status.status == PropertyIndexState.READY
2736+
assert status.status == InvertedIndexState.READY
27372737

27382738
# cancelling when no task is live is an idempotent no-op
27392739
task = collection.config.cancel_property_index_task("name", "searchable")
2740-
assert task.status == PropertyIndexTaskStatus.NO_OP
2740+
assert task.status == InvertedIndexTaskStatus.NO_OP
27412741

27422742
# the pre-existing delete API removes the index again
27432743
assert collection.config.delete_property_index("name", "searchable") is True
@@ -2765,7 +2765,7 @@ def test_property_reindex_range_filters(collection_factory: CollectionFactory) -
27652765
"age", "rangeFilters", wait_for_completion=True
27662766
)
27672767
assert status.type == "rangeFilters"
2768-
assert status.status == PropertyIndexState.READY
2768+
assert status.status == InvertedIndexState.READY
27692769

27702770
entry = next(
27712771
index
@@ -2774,7 +2774,7 @@ def test_property_reindex_range_filters(collection_factory: CollectionFactory) -
27742774
for index in prop.indexes
27752775
if index.type == "rangeFilters"
27762776
)
2777-
assert entry.status == PropertyIndexState.READY
2777+
assert entry.status == InvertedIndexState.READY
27782778

27792779

27802780
def test_property_reindex_coupled_tokenization_change(
@@ -2801,7 +2801,7 @@ def test_property_reindex_coupled_tokenization_change(
28012801
task = collection.config.update_property_index(
28022802
"name", "searchable", tokenization=Tokenization.FIELD
28032803
)
2804-
assert task.status == PropertyIndexTaskStatus.STARTED
2804+
assert task.status == InvertedIndexTaskStatus.STARTED
28052805
assert task.task_id is not None
28062806

28072807
prop = next(p for p in collection.config.get_property_indexes().properties if p.name == "name")
@@ -2821,12 +2821,12 @@ def test_property_reindex_coupled_tokenization_change(
28212821
status = collection.config.update_property_index(
28222822
"name", "searchable", tokenization=Tokenization.FIELD, wait_for_completion=True
28232823
)
2824-
assert status.status == PropertyIndexState.READY
2824+
assert status.status == InvertedIndexState.READY
28252825
assert status.tokenization == Tokenization.FIELD
28262826

28272827
prop = next(p for p in collection.config.get_property_indexes().properties if p.name == "name")
28282828
filterable = next(i for i in prop.indexes if i.type == "filterable")
2829-
assert filterable.status == PropertyIndexState.READY
2829+
assert filterable.status == InvertedIndexState.READY
28302830
assert filterable.tokenization == Tokenization.FIELD
28312831

28322832

@@ -2854,13 +2854,13 @@ def test_property_reindex_multi_tenant(collection_factory: CollectionFactory) ->
28542854
"age", "rangeFilters", tenants=["tenant1", "tenant2"], wait_for_completion=True
28552855
)
28562856
assert status.type == "rangeFilters"
2857-
assert status.status == PropertyIndexState.READY
2857+
assert status.status == InvertedIndexState.READY
28582858

28592859
status = collection.config.rebuild_property_index(
28602860
"age", "rangeFilters", tenants=["tenant1"], wait_for_completion=True
28612861
)
28622862
assert status.type == "rangeFilters"
2863-
assert status.status == PropertyIndexState.READY
2863+
assert status.status == InvertedIndexState.READY
28642864

28652865

28662866
@pytest.mark.asyncio
@@ -2885,20 +2885,20 @@ async def test_property_reindex_async(async_collection_factory: AsyncCollectionF
28852885
"name", "searchable", tokenization=Tokenization.WORD, wait_for_completion=True
28862886
)
28872887
assert status.type == "searchable"
2888-
assert status.status == PropertyIndexState.READY
2888+
assert status.status == InvertedIndexState.READY
28892889

28902890
task = await collection.config.update_property_index(
28912891
"name", "searchable", tokenization=Tokenization.WORD
28922892
)
2893-
assert task.status == PropertyIndexTaskStatus.NO_OP
2893+
assert task.status == InvertedIndexTaskStatus.NO_OP
28942894

28952895
indexes = await collection.config.get_property_indexes()
28962896
assert indexes.collection == collection.name
28972897

28982898
status = await collection.config.rebuild_property_index(
28992899
"name", "searchable", wait_for_completion=True
29002900
)
2901-
assert status.status == PropertyIndexState.READY
2901+
assert status.status == InvertedIndexState.READY
29022902

29032903
task = await collection.config.cancel_property_index_task("name", "searchable")
2904-
assert task.status == PropertyIndexTaskStatus.NO_OP
2904+
assert task.status == InvertedIndexTaskStatus.NO_OP

mock_tests/test_property_reindex.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from mock_tests.conftest import MOCK_IP, MOCK_PORT, MOCK_PORT_GRPC
1111
from weaviate.collections.classes.config import (
1212
DataType,
13-
PropertyIndexState,
14-
PropertyIndexTaskStatus,
15-
PropertyIndexType,
13+
InvertedIndexState,
14+
InvertedIndexTaskStatus,
15+
InvertedIndexType,
1616
Tokenization,
1717
)
1818
from weaviate.exceptions import (
@@ -64,7 +64,7 @@ def test_update_property_index_started(
6464
algorithm="blockmax",
6565
)
6666
assert task.task_id == TASK_ID
67-
assert task.status == PropertyIndexTaskStatus.STARTED
67+
assert task.status == InvertedIndexTaskStatus.STARTED
6868
weaviate_139_mock.check_assertions()
6969

7070

@@ -81,7 +81,7 @@ def test_update_property_index_no_op(
8181
"name", "searchable", tokenization=Tokenization.WORD
8282
)
8383
assert task.task_id is None
84-
assert task.status == PropertyIndexTaskStatus.NO_OP
84+
assert task.status == InvertedIndexTaskStatus.NO_OP
8585
weaviate_139_mock.check_assertions()
8686

8787

@@ -100,7 +100,7 @@ def test_update_property_index_range_filters_with_tenants(
100100
"age", "rangeFilters", tenants=["tenant1", "tenant2"]
101101
)
102102
assert task.task_id == TASK_ID
103-
assert task.status == PropertyIndexTaskStatus.STARTED
103+
assert task.status == InvertedIndexTaskStatus.STARTED
104104
weaviate_139_mock.check_assertions()
105105

106106

@@ -129,7 +129,7 @@ def test_update_property_index_wait_for_completion(
129129
"name", "searchable", tokenization=Tokenization.WORD, wait_for_completion=True
130130
)
131131
assert status.type == "searchable"
132-
assert status.status == PropertyIndexState.READY
132+
assert status.status == InvertedIndexState.READY
133133
assert status.tokenization == Tokenization.WORD
134134
weaviate_139_mock.check_assertions()
135135

@@ -148,7 +148,7 @@ def test_update_property_index_bare_str_tenant(
148148
task = client_139.collections.use(COLLECTION).config.update_property_index(
149149
"age", "rangeFilters", tenants="tenant1"
150150
)
151-
assert task.status == PropertyIndexTaskStatus.STARTED
151+
assert task.status == InvertedIndexTaskStatus.STARTED
152152
weaviate_139_mock.check_assertions()
153153

154154

@@ -251,7 +251,7 @@ def test_rebuild_property_index(
251251
"name", "searchable"
252252
)
253253
assert task.task_id == TASK_ID
254-
assert task.status == PropertyIndexTaskStatus.STARTED
254+
assert task.status == InvertedIndexTaskStatus.STARTED
255255
weaviate_139_mock.check_assertions()
256256

257257

@@ -269,7 +269,7 @@ def test_rebuild_property_index_with_tenants(
269269
"age", "rangeFilters", tenants=["tenant1", "tenant2"]
270270
)
271271
assert task.task_id == TASK_ID
272-
assert task.status == PropertyIndexTaskStatus.STARTED
272+
assert task.status == InvertedIndexTaskStatus.STARTED
273273
weaviate_139_mock.check_assertions()
274274

275275

@@ -286,7 +286,7 @@ def test_cancel_property_index_task_cancelled(
286286
"name", "searchable"
287287
)
288288
assert task.task_id == TASK_ID
289-
assert task.status == PropertyIndexTaskStatus.CANCELLED
289+
assert task.status == InvertedIndexTaskStatus.CANCELLED
290290
weaviate_139_mock.check_assertions()
291291

292292

@@ -303,7 +303,7 @@ def test_cancel_property_index_task_no_op(
303303
"name", "searchable"
304304
)
305305
assert task.task_id is None
306-
assert task.status == PropertyIndexTaskStatus.NO_OP
306+
assert task.status == InvertedIndexTaskStatus.NO_OP
307307
weaviate_139_mock.check_assertions()
308308

309309

@@ -360,7 +360,7 @@ def test_get_property_indexes(
360360
assert len(name.indexes) == 2
361361
searchable, filterable = name.indexes
362362
assert searchable.type == "searchable"
363-
assert searchable.status == PropertyIndexState.INDEXING
363+
assert searchable.status == InvertedIndexState.INDEXING
364364
assert searchable.progress == 0.5
365365
assert searchable.task_id == TASK_ID
366366
assert searchable.tokenization == Tokenization.WORD
@@ -379,7 +379,7 @@ def test_get_property_indexes(
379379
assert age.description is None
380380
assert len(age.indexes) == 1
381381
assert age.indexes[0].type == "rangeFilters"
382-
assert age.indexes[0].status == PropertyIndexState.READY
382+
assert age.indexes[0].status == InvertedIndexState.READY
383383
assert age.indexes[0].progress is None
384384
assert age.indexes[0].task_id is None
385385
assert age.indexes[0].tokenization is None
@@ -398,18 +398,18 @@ def test_get_property_indexes(
398398
@pytest.mark.parametrize(
399399
"index_name,wire",
400400
[
401-
(PropertyIndexType.SEARCHABLE, "searchable"),
401+
(InvertedIndexType.SEARCHABLE, "searchable"),
402402
("searchable", "searchable"),
403-
(PropertyIndexType.FILTERABLE, "filterable"),
403+
(InvertedIndexType.FILTERABLE, "filterable"),
404404
("filterable", "filterable"),
405-
(PropertyIndexType.RANGE_FILTERS, "rangeFilters"),
405+
(InvertedIndexType.RANGE_FILTERS, "rangeFilters"),
406406
("rangeFilters", "rangeFilters"),
407407
],
408408
)
409409
def test_update_property_index_enum_and_literal_hit_same_route(
410410
weaviate_139_mock: HTTPServer,
411411
client_139: weaviate.WeaviateClient,
412-
index_name: Union[PropertyIndexType, str],
412+
index_name: Union[InvertedIndexType, str],
413413
wire: str,
414414
) -> None:
415415
"""The enum and literal forms of index_name hit the exact same wire route."""
@@ -423,25 +423,25 @@ def test_update_property_index_enum_and_literal_hit_same_route(
423423
"name",
424424
index_name, # type: ignore
425425
)
426-
assert task.status == PropertyIndexTaskStatus.STARTED
426+
assert task.status == InvertedIndexTaskStatus.STARTED
427427
weaviate_139_mock.check_assertions()
428428

429429

430430
@pytest.mark.parametrize(
431431
"index_name,wire",
432432
[
433-
(PropertyIndexType.SEARCHABLE, "searchable"),
433+
(InvertedIndexType.SEARCHABLE, "searchable"),
434434
("searchable", "searchable"),
435-
(PropertyIndexType.FILTERABLE, "filterable"),
435+
(InvertedIndexType.FILTERABLE, "filterable"),
436436
("filterable", "filterable"),
437-
(PropertyIndexType.RANGE_FILTERS, "rangeFilters"),
437+
(InvertedIndexType.RANGE_FILTERS, "rangeFilters"),
438438
("rangeFilters", "rangeFilters"),
439439
],
440440
)
441441
def test_delete_property_index_enum_and_literal_hit_same_route(
442442
weaviate_139_mock: HTTPServer,
443443
client_139: weaviate.WeaviateClient,
444-
index_name: Union[PropertyIndexType, str],
444+
index_name: Union[InvertedIndexType, str],
445445
wire: str,
446446
) -> None:
447447
"""The enum and literal forms of index_name hit the exact same wire route."""
@@ -462,12 +462,12 @@ def test_delete_property_index_enum_and_literal_hit_same_route(
462462

463463
@pytest.mark.parametrize(
464464
"index_name",
465-
[PropertyIndexType.RANGE_FILTERS, "rangeFilters"],
465+
[InvertedIndexType.RANGE_FILTERS, "rangeFilters"],
466466
)
467467
def test_rebuild_property_index_enum_and_literal_hit_same_route(
468468
weaviate_139_mock: HTTPServer,
469469
client_139: weaviate.WeaviateClient,
470-
index_name: Union[PropertyIndexType, str],
470+
index_name: Union[InvertedIndexType, str],
471471
) -> None:
472472
"""The enum and literal forms of index_name hit the exact same rebuild route."""
473473
weaviate_139_mock.expect_request(
@@ -480,18 +480,18 @@ def test_rebuild_property_index_enum_and_literal_hit_same_route(
480480
"age",
481481
index_name, # type: ignore
482482
)
483-
assert task.status == PropertyIndexTaskStatus.STARTED
483+
assert task.status == InvertedIndexTaskStatus.STARTED
484484
weaviate_139_mock.check_assertions()
485485

486486

487487
@pytest.mark.parametrize(
488488
"index_name",
489-
[PropertyIndexType.RANGE_FILTERS, "rangeFilters"],
489+
[InvertedIndexType.RANGE_FILTERS, "rangeFilters"],
490490
)
491491
def test_cancel_property_index_task_enum_and_literal_hit_same_route(
492492
weaviate_139_mock: HTTPServer,
493493
client_139: weaviate.WeaviateClient,
494-
index_name: Union[PropertyIndexType, str],
494+
index_name: Union[InvertedIndexType, str],
495495
) -> None:
496496
"""The enum and literal forms of index_name hit the exact same cancel route."""
497497
weaviate_139_mock.expect_request(
@@ -504,7 +504,7 @@ def test_cancel_property_index_task_enum_and_literal_hit_same_route(
504504
"age",
505505
index_name, # type: ignore
506506
)
507-
assert task.status == PropertyIndexTaskStatus.CANCELLED
507+
assert task.status == InvertedIndexTaskStatus.CANCELLED
508508
weaviate_139_mock.check_assertions()
509509

510510

weaviate/classes/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
DataType,
55
GenerativeSearches,
66
IndexName,
7+
InvertedIndexType,
78
PQEncoderDistribution,
89
PQEncoderType,
910
Property,
10-
PropertyIndexType,
1111
Reconfigure,
1212
ReferenceProperty,
1313
ReplicationDeletionStrategy,
@@ -38,7 +38,7 @@
3838
"MultiVectorAggregation",
3939
"ReplicationDeletionStrategy",
4040
"Property",
41-
"PropertyIndexType",
41+
"InvertedIndexType",
4242
"PQEncoderDistribution",
4343
"PQEncoderType",
4444
"ReferenceProperty",

0 commit comments

Comments
 (0)