2727 PropertyIndexState ,
2828 PropertyIndexStatus ,
2929 PropertyIndexTask ,
30+ PropertyIndexType ,
3031 PropertyType ,
3132 ReferenceProperty ,
3233 ShardStatus ,
@@ -670,7 +671,7 @@ async def _execute() -> None:
670671 def delete_property_index (
671672 self ,
672673 property_name : str ,
673- index_name : IndexName ,
674+ index_name : Union [ PropertyIndexType , IndexName ] ,
674675 ) -> executor .Result [bool ]:
675676 """Delete a property index from the collection in Weaviate.
676677
@@ -686,6 +687,8 @@ def delete_property_index(
686687 weaviate.exceptions.UnexpectedStatusCodeError: If Weaviate reports a non-OK status.
687688 weaviate.exceptions.WeaviateInvalidInputError: If the property or index does not exist.
688689 """
690+ if isinstance (index_name , PropertyIndexType ):
691+ index_name = cast (IndexName , index_name .value )
689692 _validate_input (
690693 [_ValidateArgument (expected = [str ], name = "property_name" , value = property_name )]
691694 )
@@ -750,7 +753,7 @@ async def _execute() -> PropertyIndexStatus:
750753 def update_property_index (
751754 self ,
752755 property_name : str ,
753- index_name : IndexName ,
756+ index_name : Union [ PropertyIndexType , IndexName ] ,
754757 * ,
755758 tokenization : Optional [Tokenization ] = None ,
756759 algorithm : Optional [Literal ["blockmax" ]] = None ,
@@ -762,7 +765,7 @@ def update_property_index(
762765 def update_property_index (
763766 self ,
764767 property_name : str ,
765- index_name : IndexName ,
768+ index_name : Union [ PropertyIndexType , IndexName ] ,
766769 * ,
767770 tokenization : Optional [Tokenization ] = None ,
768771 algorithm : Optional [Literal ["blockmax" ]] = None ,
@@ -773,7 +776,7 @@ def update_property_index(
773776 def update_property_index (
774777 self ,
775778 property_name : str ,
776- index_name : IndexName ,
779+ index_name : Union [ PropertyIndexType , IndexName ] ,
777780 * ,
778781 tokenization : Optional [Tokenization ] = None ,
779782 algorithm : Optional [Literal ["blockmax" ]] = None ,
@@ -789,7 +792,8 @@ def update_property_index(
789792
790793 Args:
791794 property_name: The property whose index to create or migrate.
792- index_name: The type of the index, one of `searchable`, `filterable` or `rangeFilters`.
795+ index_name: The type of the index, a `PropertyIndexType` value or one of the literals
796+ `searchable`, `filterable` or `rangeFilters`.
793797 tokenization: The tokenization of the index. Required when creating a `searchable` index;
794798 optional as a change on an existing `searchable` or `filterable` index. Not valid for
795799 `rangeFilters`.
@@ -811,6 +815,8 @@ def update_property_index(
811815 weaviate.exceptions.ReindexCanceledError: If `wait_for_completion=True` and the reindexing task was cancelled.
812816 """
813817 self .__check_property_reindex_support ("Collection config update_property_index" )
818+ if isinstance (index_name , PropertyIndexType ):
819+ index_name = cast (IndexName , index_name .value )
814820 _validate_input (
815821 [_ValidateArgument (expected = [str ], name = "property_name" , value = property_name )]
816822 )
@@ -878,7 +884,7 @@ async def _execute() -> Union[PropertyIndexTask, PropertyIndexStatus]:
878884 def rebuild_property_index (
879885 self ,
880886 property_name : str ,
881- index_name : IndexName ,
887+ index_name : Union [ PropertyIndexType , IndexName ] ,
882888 * ,
883889 tenants : Union [List [str ], str , None ] = None ,
884890 wait_for_completion : Literal [True ],
@@ -888,7 +894,7 @@ def rebuild_property_index(
888894 def rebuild_property_index (
889895 self ,
890896 property_name : str ,
891- index_name : IndexName ,
897+ index_name : Union [ PropertyIndexType , IndexName ] ,
892898 * ,
893899 tenants : Union [List [str ], str , None ] = None ,
894900 wait_for_completion : Literal [False ] = False ,
@@ -897,7 +903,7 @@ def rebuild_property_index(
897903 def rebuild_property_index (
898904 self ,
899905 property_name : str ,
900- index_name : IndexName ,
906+ index_name : Union [ PropertyIndexType , IndexName ] ,
901907 * ,
902908 tenants : Union [List [str ], str , None ] = None ,
903909 wait_for_completion : bool = False ,
@@ -906,7 +912,8 @@ def rebuild_property_index(
906912
907913 Args:
908914 property_name: The property whose index to rebuild.
909- index_name: The type of the index, one of `searchable`, `filterable` or `rangeFilters`.
915+ index_name: The type of the index, a `PropertyIndexType` value or one of the literals
916+ `searchable`, `filterable` or `rangeFilters`.
910917 tenants: The tenant/list of tenants for which to rebuild the index on a multi-tenant
911918 collection. If not provided, all tenants are affected.
912919 wait_for_completion: Whether to wait until the index reports `ready`. By default False.
@@ -923,6 +930,8 @@ def rebuild_property_index(
923930 weaviate.exceptions.ReindexCanceledError: If `wait_for_completion=True` and the reindexing task was cancelled.
924931 """
925932 self .__check_property_reindex_support ("Collection config rebuild_property_index" )
933+ if isinstance (index_name , PropertyIndexType ):
934+ index_name = cast (IndexName , index_name .value )
926935 _validate_input (
927936 [_ValidateArgument (expected = [str ], name = "property_name" , value = property_name )]
928937 )
@@ -982,7 +991,7 @@ async def _execute() -> Union[PropertyIndexTask, PropertyIndexStatus]:
982991 def cancel_property_index_task (
983992 self ,
984993 property_name : str ,
985- index_name : IndexName ,
994+ index_name : Union [ PropertyIndexType , IndexName ] ,
986995 ) -> executor .Result [PropertyIndexTask ]:
987996 """Cancel the live reindexing task of a property index.
988997
@@ -993,7 +1002,8 @@ def cancel_property_index_task(
9931002
9941003 Args:
9951004 property_name: The property whose reindexing task to cancel.
996- index_name: The type of the index, one of `searchable`, `filterable` or `rangeFilters`.
1005+ index_name: The type of the index, a `PropertyIndexType` value or one of the literals
1006+ `searchable`, `filterable` or `rangeFilters`.
9971007
9981008 Returns:
9991009 A `PropertyIndexTask` with status `CANCELLED` if a live task was cancelled or `NO_OP` otherwise.
@@ -1004,6 +1014,8 @@ def cancel_property_index_task(
10041014 weaviate.exceptions.UnexpectedStatusCodeError: If Weaviate reports a non-OK status.
10051015 """
10061016 self .__check_property_reindex_support ("Collection config cancel_property_index_task" )
1017+ if isinstance (index_name , PropertyIndexType ):
1018+ index_name = cast (IndexName , index_name .value )
10071019 _validate_input (
10081020 [_ValidateArgument (expected = [str ], name = "property_name" , value = property_name )]
10091021 )
0 commit comments