Skip to content

Commit e65fa0b

Browse files
committed
fix: drop internal alias wording, extend route-equality coverage (#2098)
The RANGE_FILTERS docstring said "rangeable", the internal write-path alias the RFC deliberately keeps unsurfaced — say rangeFilters instead. Extends the route-equality parametrization with FILTERABLE and adds enum-vs-literal route cases for rebuild_property_index and cancel_property_index_task.
1 parent 0120c65 commit e65fa0b

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

mock_tests/test_property_reindex.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ def test_get_property_indexes(
400400
[
401401
(PropertyIndexType.SEARCHABLE, "searchable"),
402402
("searchable", "searchable"),
403+
(PropertyIndexType.FILTERABLE, "filterable"),
404+
("filterable", "filterable"),
403405
(PropertyIndexType.RANGE_FILTERS, "rangeFilters"),
404406
("rangeFilters", "rangeFilters"),
405407
],
@@ -430,6 +432,8 @@ def test_update_property_index_enum_and_literal_hit_same_route(
430432
[
431433
(PropertyIndexType.SEARCHABLE, "searchable"),
432434
("searchable", "searchable"),
435+
(PropertyIndexType.FILTERABLE, "filterable"),
436+
("filterable", "filterable"),
433437
(PropertyIndexType.RANGE_FILTERS, "rangeFilters"),
434438
("rangeFilters", "rangeFilters"),
435439
],
@@ -456,6 +460,54 @@ def test_delete_property_index_enum_and_literal_hit_same_route(
456460
weaviate_139_mock.check_assertions()
457461

458462

463+
@pytest.mark.parametrize(
464+
"index_name",
465+
[PropertyIndexType.RANGE_FILTERS, "rangeFilters"],
466+
)
467+
def test_rebuild_property_index_enum_and_literal_hit_same_route(
468+
weaviate_139_mock: HTTPServer,
469+
client_139: weaviate.WeaviateClient,
470+
index_name: Union[PropertyIndexType, str],
471+
) -> None:
472+
"""The enum and literal forms of index_name hit the exact same rebuild route."""
473+
weaviate_139_mock.expect_request(
474+
f"{SCHEMA_PATH}/properties/age/index/rangeFilters/rebuild",
475+
method="POST",
476+
json={},
477+
).respond_with_json({"taskId": TASK_ID, "status": "STARTED"}, status=202)
478+
479+
task = client_139.collections.use(COLLECTION).config.rebuild_property_index(
480+
"age",
481+
index_name, # type: ignore
482+
)
483+
assert task.status == PropertyIndexTaskStatus.STARTED
484+
weaviate_139_mock.check_assertions()
485+
486+
487+
@pytest.mark.parametrize(
488+
"index_name",
489+
[PropertyIndexType.RANGE_FILTERS, "rangeFilters"],
490+
)
491+
def test_cancel_property_index_task_enum_and_literal_hit_same_route(
492+
weaviate_139_mock: HTTPServer,
493+
client_139: weaviate.WeaviateClient,
494+
index_name: Union[PropertyIndexType, str],
495+
) -> None:
496+
"""The enum and literal forms of index_name hit the exact same cancel route."""
497+
weaviate_139_mock.expect_request(
498+
f"{SCHEMA_PATH}/properties/age/index/rangeFilters/cancel",
499+
method="POST",
500+
json={},
501+
).respond_with_json({"taskId": TASK_ID, "status": "CANCELLED"}, status=202)
502+
503+
task = client_139.collections.use(COLLECTION).config.cancel_property_index_task(
504+
"age",
505+
index_name, # type: ignore
506+
)
507+
assert task.status == PropertyIndexTaskStatus.CANCELLED
508+
weaviate_139_mock.check_assertions()
509+
510+
459511
def test_get_property_indexes_reference_property(
460512
weaviate_139_mock: HTTPServer, client_139: weaviate.WeaviateClient
461513
) -> None:

weaviate/collections/classes/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class PropertyIndexType(str, BaseEnum):
123123
Attributes:
124124
SEARCHABLE: The searchable index, used for keyword (BM25) searches over text properties.
125125
FILTERABLE: The filterable index, used for exact-match filtering.
126-
RANGE_FILTERS: The rangeable index, used for range filtering.
126+
RANGE_FILTERS: The rangeFilters index, used for range filtering.
127127
"""
128128

129129
SEARCHABLE = "searchable"

0 commit comments

Comments
 (0)