4343 IndexName ,
4444 InvertedIndexState ,
4545 InvertedIndexTaskStatus ,
46+ InvertedIndexType ,
4647)
4748from weaviate .collections .classes .tenants import Tenant
4849from weaviate .exceptions import (
@@ -2703,15 +2704,18 @@ def test_property_reindex_searchable_lifecycle(collection_factory: CollectionFac
27032704
27042705 # create the searchable index declaratively and wait for it to become ready
27052706 status = collection .config .update_property_index (
2706- "name" , "searchable" , tokenization = Tokenization .WORD , wait_for_completion = True
2707+ "name" ,
2708+ InvertedIndexType .SEARCHABLE ,
2709+ tokenization = Tokenization .WORD ,
2710+ wait_for_completion = True ,
27072711 )
27082712 assert status .type == "searchable"
27092713 assert status .status == InvertedIndexState .READY
27102714 assert status .tokenization == Tokenization .WORD
27112715
27122716 # re-putting the matching configuration is a no-op
27132717 task = collection .config .update_property_index (
2714- "name" , "searchable" , tokenization = Tokenization .WORD
2718+ "name" , InvertedIndexType . SEARCHABLE , tokenization = Tokenization .WORD
27152719 )
27162720 assert task .status == InvertedIndexTaskStatus .NO_OP
27172721 assert task .task_id is None
@@ -2730,13 +2734,13 @@ def test_property_reindex_searchable_lifecycle(collection_factory: CollectionFac
27302734
27312735 # rebuild the index from scratch
27322736 status = collection .config .rebuild_property_index (
2733- "name" , "searchable" , wait_for_completion = True
2737+ "name" , InvertedIndexType . SEARCHABLE , wait_for_completion = True
27342738 )
27352739 assert status .type == "searchable"
27362740 assert status .status == InvertedIndexState .READY
27372741
27382742 # cancelling when no task is live is an idempotent no-op
2739- task = collection .config .cancel_property_index_task ("name" , "searchable" )
2743+ task = collection .config .cancel_property_index_task ("name" , InvertedIndexType . SEARCHABLE )
27402744 assert task .status == InvertedIndexTaskStatus .NO_OP
27412745
27422746 # the pre-existing delete API removes the index again
@@ -2762,7 +2766,7 @@ def test_property_reindex_range_filters(collection_factory: CollectionFactory) -
27622766 collection .data .insert_many ([{"age" : i } for i in range (10 )])
27632767
27642768 status = collection .config .update_property_index (
2765- "age" , "rangeFilters" , wait_for_completion = True
2769+ "age" , InvertedIndexType . RANGE_FILTERS , wait_for_completion = True
27662770 )
27672771 assert status .type == "rangeFilters"
27682772 assert status .status == InvertedIndexState .READY
@@ -2799,7 +2803,7 @@ def test_property_reindex_coupled_tokenization_change(
27992803 collection .data .insert_many ([{"name" : f"object { i } " } for i in range (100 )])
28002804
28012805 task = collection .config .update_property_index (
2802- "name" , "searchable" , tokenization = Tokenization .FIELD
2806+ "name" , InvertedIndexType . SEARCHABLE , tokenization = Tokenization .FIELD
28032807 )
28042808 assert task .status == InvertedIndexTaskStatus .STARTED
28052809 assert task .task_id is not None
@@ -2819,7 +2823,10 @@ def test_property_reindex_coupled_tokenization_change(
28192823
28202824 # poll the status endpoint (via the wait path of a NO_OP upsert) until the migration is done
28212825 status = collection .config .update_property_index (
2822- "name" , "searchable" , tokenization = Tokenization .FIELD , wait_for_completion = True
2826+ "name" ,
2827+ InvertedIndexType .SEARCHABLE ,
2828+ tokenization = Tokenization .FIELD ,
2829+ wait_for_completion = True ,
28232830 )
28242831 assert status .status == InvertedIndexState .READY
28252832 assert status .tokenization == Tokenization .FIELD
@@ -2851,13 +2858,16 @@ def test_property_reindex_multi_tenant(collection_factory: CollectionFactory) ->
28512858 collection .with_tenant ("tenant1" ).data .insert_many ([{"age" : i } for i in range (5 )])
28522859
28532860 status = collection .config .update_property_index (
2854- "age" , "rangeFilters" , tenants = ["tenant1" , "tenant2" ], wait_for_completion = True
2861+ "age" ,
2862+ InvertedIndexType .RANGE_FILTERS ,
2863+ tenants = ["tenant1" , "tenant2" ],
2864+ wait_for_completion = True ,
28552865 )
28562866 assert status .type == "rangeFilters"
28572867 assert status .status == InvertedIndexState .READY
28582868
28592869 status = collection .config .rebuild_property_index (
2860- "age" , "rangeFilters" , tenants = ["tenant1" ], wait_for_completion = True
2870+ "age" , InvertedIndexType . RANGE_FILTERS , tenants = ["tenant1" ], wait_for_completion = True
28612871 )
28622872 assert status .type == "rangeFilters"
28632873 assert status .status == InvertedIndexState .READY
@@ -2882,23 +2892,26 @@ async def test_property_reindex_async(async_collection_factory: AsyncCollectionF
28822892 await collection .data .insert_many ([{"name" : f"object { i } " } for i in range (10 )])
28832893
28842894 status = await collection .config .update_property_index (
2885- "name" , "searchable" , tokenization = Tokenization .WORD , wait_for_completion = True
2895+ "name" ,
2896+ InvertedIndexType .SEARCHABLE ,
2897+ tokenization = Tokenization .WORD ,
2898+ wait_for_completion = True ,
28862899 )
28872900 assert status .type == "searchable"
28882901 assert status .status == InvertedIndexState .READY
28892902
28902903 task = await collection .config .update_property_index (
2891- "name" , "searchable" , tokenization = Tokenization .WORD
2904+ "name" , InvertedIndexType . SEARCHABLE , tokenization = Tokenization .WORD
28922905 )
28932906 assert task .status == InvertedIndexTaskStatus .NO_OP
28942907
28952908 indexes = await collection .config .get_property_indexes ()
28962909 assert indexes .collection == collection .name
28972910
28982911 status = await collection .config .rebuild_property_index (
2899- "name" , "searchable" , wait_for_completion = True
2912+ "name" , InvertedIndexType . SEARCHABLE , wait_for_completion = True
29002913 )
29012914 assert status .status == InvertedIndexState .READY
29022915
2903- task = await collection .config .cancel_property_index_task ("name" , "searchable" )
2916+ task = await collection .config .cancel_property_index_task ("name" , InvertedIndexType . SEARCHABLE )
29042917 assert task .status == InvertedIndexTaskStatus .NO_OP
0 commit comments