From c107de6a44df08c3276a09d4d1327775a4a71666 Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Wed, 11 Feb 2026 16:06:55 -0800 Subject: [PATCH 01/13] make a request and return resposne --- weaviate/collections/collections/async_.pyi | 9 ++++ weaviate/collections/collections/executor.py | 43 +++++++++++++++++++- weaviate/collections/collections/sync.pyi | 9 ++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/weaviate/collections/collections/async_.pyi b/weaviate/collections/collections/async_.pyi index 4aeb7b491..e3c3d537e 100644 --- a/weaviate/collections/collections/async_.pyi +++ b/weaviate/collections/collections/async_.pyi @@ -1,5 +1,6 @@ from typing import Dict, List, Literal, Optional, Sequence, Type, Union, overload +from httpx import Response from typing_extensions import deprecated from weaviate.collections.classes.config import ( @@ -27,6 +28,8 @@ from weaviate.collections.collection import CollectionAsync from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect.v4 import ConnectionAsync +from weaviate.collections.collections.executor import IndexName + class _CollectionsAsync(_CollectionsBase[ConnectionAsync]): @overload async def create( @@ -122,6 +125,12 @@ class _CollectionsAsync(_CollectionsBase[ConnectionAsync]): async def delete_all(self) -> None: ... async def exists(self, name: str) -> bool: ... async def export_config(self, name: str) -> CollectionConfig: ... + def delete_property_index( + self, + name: str, + property: str, # DNJ TODO - accept property instance if exists + index_name: IndexName, + ) -> bool: ... # DNJ TODO something wrong with return here @overload async def list_all(self, simple: Literal[False]) -> Dict[str, CollectionConfig]: ... @overload diff --git a/weaviate/collections/collections/executor.py b/weaviate/collections/collections/executor.py index 69b2baa64..9203e40c4 100644 --- a/weaviate/collections/collections/executor.py +++ b/weaviate/collections/collections/executor.py @@ -1,4 +1,5 @@ import asyncio +from enum import Enum from typing import ( Awaitable, Dict, @@ -56,7 +57,10 @@ from weaviate.warnings import _Warnings CollectionType = TypeVar("CollectionType", Collection, CollectionAsync) - +class IndexName(Enum): #DNJ TODO -somewhere else? + Searchable="searchable", + Filterable="filterable" + RangeFilters="rangeFilters" class _CollectionsExecutor(Generic[ConnectionType]): def __init__(self, connection: ConnectionType): @@ -329,6 +333,43 @@ def resp(res: Response) -> bool: error_msg="Collection may not exist.", status_codes=_ExpectedStatusCodes(ok_in=[200, 404], error="collection exists"), ) + + def delete_property_index( + self, + name: str, + property: str, # DNJ TODO - accept property instance if exists + index_name: IndexName, + ) -> executor.Result[bool]: # DNJ TODO - confirm output + """ # DNJ TODO + Docstring for delete_property_index + + :param self: Description + :param name: Description + :type name: str + :param property: Description + :type property: str + :param index_name: Description + :type index_name: IndexName + :return: Description + :rtype: Result[None] + """ + _validate_input([_ValidateArgument(expected=[str], name="name", value=name)]) # DNJ TODO + path = ( + f"/schema/{_capitalize_first_letter(name)}" + + f"/properties/{property}" + + f"/index/{index_name.value}" + ) + + def resp(res: Response) -> bool: + return res.status_code == 200 + + return executor.execute( + response_callback=resp, + method=self._connection.delete, + path=path, + error_msg="Property may not exist.", # DNJ TODO - find all error states + status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), + ) def export_config( self, diff --git a/weaviate/collections/collections/sync.pyi b/weaviate/collections/collections/sync.pyi index 22f3356e6..06a2270b6 100644 --- a/weaviate/collections/collections/sync.pyi +++ b/weaviate/collections/collections/sync.pyi @@ -1,5 +1,6 @@ from typing import Dict, List, Literal, Optional, Sequence, Type, Union, overload +from httpx import Response from typing_extensions import deprecated from weaviate.collections.classes.config import ( @@ -27,6 +28,8 @@ from weaviate.collections.collection import Collection from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect.v4 import ConnectionSync +from weaviate.collections.collections.executor import IndexName + class _Collections(_CollectionsBase[ConnectionSync]): @overload def create( @@ -122,6 +125,12 @@ class _Collections(_CollectionsBase[ConnectionSync]): def delete_all(self) -> None: ... def exists(self, name: str) -> bool: ... def export_config(self, name: str) -> CollectionConfig: ... + def delete_property_index( + self, + name: str, + property: str, # DNJ TODO - accept property instance if exists + index_name: IndexName, + ) -> bool: ... @overload def list_all(self, simple: Literal[False]) -> Dict[str, CollectionConfig]: ... @overload From 6e7dc7dc3c8e72519606ce2737007933b6b6a09c Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 08:39:54 -0800 Subject: [PATCH 02/13] request in config --- weaviate/collections/classes/config.py | 5 ++++ weaviate/collections/config/executor.py | 40 ++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index df79252b6..ebcf33c16 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -102,6 +102,11 @@ "high", ] +IndexName: TypeAlias = Literal[ + "searchable", + "filterable", + "rangeFilters", +] class ConsistencyLevel(str, BaseEnum): """The consistency levels when writing to Weaviate with replication enabled. diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index bb1f33859..35f5e4651 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -19,6 +19,7 @@ from weaviate.collections.classes.config import ( CollectionConfig, CollectionConfigSimple, + IndexName, Property, PropertyType, ReferenceProperty, @@ -52,7 +53,7 @@ from weaviate.exceptions import ( WeaviateInvalidInputError, ) -from weaviate.util import _decode_json_response_dict, _decode_json_response_list +from weaviate.util import _capitalize_first_letter, _decode_json_response_dict, _decode_json_response_list from weaviate.validator import _validate_input, _ValidateArgument from weaviate.warnings import _Warnings @@ -581,3 +582,40 @@ async def _execute() -> None: return _execute() schema = executor.result(self.__get()) return executor.result(resp(schema)) + + def delete_property_index( + self, + property: str, + index_name: IndexName, + ) -> executor.Result[bool]: # DNJ TODO - confirm output + """ # DNJ TODO + Docstring for delete_property_index + + :param self: Description + :param name: Description + :type name: str + :param property: Description + :type property: str + :param index_name: Description + :type index_name: IndexName + :return: Description + :rtype: Result[None] + """ + _validate_input([_ValidateArgument(expected=[str], name="property", value=property)]) + _validate_input([_ValidateArgument(expected=[IndexName], name="index_name", value=index_name)]) + path = ( + f"/schema/{_capitalize_first_letter(self._name)}" + + f"/properties/{property}" + + f"/index/{index_name}" + ) + + def resp(res: Response) -> bool: + return res.status_code == 200 + + return executor.execute( + response_callback=resp, + method=self._connection.delete, + path=path, + error_msg="Property may not exist.", # DNJ TODO - find all error states + status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), + ) \ No newline at end of file From dc7bf87e4de9bad3d2232048cee0e68fd28b9b78 Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 09:08:10 -0800 Subject: [PATCH 03/13] fix validation --- weaviate/collections/config/executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index 35f5e4651..cba39cc60 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -602,7 +602,7 @@ def delete_property_index( :rtype: Result[None] """ _validate_input([_ValidateArgument(expected=[str], name="property", value=property)]) - _validate_input([_ValidateArgument(expected=[IndexName], name="index_name", value=index_name)]) + _validate_input([_ValidateArgument(expected=[str], name="index_name", value=index_name)]) path = ( f"/schema/{_capitalize_first_letter(self._name)}" + f"/properties/{property}" From feb69a588654a93d8d60a9006ee21e7848afe5a4 Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 09:55:19 -0800 Subject: [PATCH 04/13] add pyi files and test stub --- integration/test_collection_config.py | 6 +++ test/collection/test_config_methods.py | 23 +++++------ weaviate/collections/classes/config.py | 1 + weaviate/collections/config/async_.pyi | 2 + weaviate/collections/config/executor.py | 51 ++++++++++++++----------- weaviate/collections/config/sync.pyi | 2 + 6 files changed, 50 insertions(+), 35 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 1ed1df103..33e4e8d42 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1950,3 +1950,9 @@ def test_object_ttl_update(collection_factory: CollectionFactory) -> None: ) conf = collection.config.get() assert conf.object_ttl_config is None + + +@pytest.mark.parametrize("index_name", ["filterable", "searchable", "rangeFilters"]) +def test_delete_property_index(index_name, collection_factory: CollectionFactory) -> None: + """Test delete index works for each index type.""" + pass diff --git a/test/collection/test_config_methods.py b/test/collection/test_config_methods.py index 4edf76e47..fbc33b702 100644 --- a/test/collection/test_config_methods.py +++ b/test/collection/test_config_methods.py @@ -1,7 +1,6 @@ - -import pytest from weaviate.collections.classes.config_methods import _collection_configs_simple_from_json + def test_collection_config_simple_from_json_with_none_vectorizer_config() -> None: """Test that _collection_configs_simple_from_json handles None vectorizer config.""" schema = { @@ -10,9 +9,7 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non "class": "TestCollection", "vectorConfig": { "default": { - "vectorizer": { - "text2vec-transformers": None - }, + "vectorizer": {"text2vec-transformers": None}, "vectorIndexType": "hnsw", "vectorIndexConfig": { "skip": False, @@ -25,15 +22,15 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non "dynamicEfFactor": 8, "vectorCacheMaxObjects": 1000000000000, "flatSearchCutoff": 40000, - "distance": "cosine" - } + "distance": "cosine", + }, } }, "properties": [], "invertedIndexConfig": { - "bm25": {"b": 0.75, "k1": 1.2}, - "cleanupIntervalSeconds": 60, - "stopwords": {"preset": "en", "additions": None, "removals": None} + "bm25": {"b": 0.75, "k1": 1.2}, + "cleanupIntervalSeconds": 60, + "stopwords": {"preset": "en", "additions": None, "removals": None}, }, "replicationConfig": {"factor": 1, "deletionStrategy": "NoAutomatedResolution"}, "shardingConfig": { @@ -44,7 +41,7 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non "actualVirtualCount": 128, "key": "_id", "strategy": "hash", - "function": "murmur3" + "function": "murmur3", }, "vectorIndexType": "hnsw", "vectorIndexConfig": { @@ -58,8 +55,8 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non "dynamicEfFactor": 8, "vectorCacheMaxObjects": 1000000000000, "flatSearchCutoff": 40000, - "distance": "cosine" - } + "distance": "cosine", + }, } ] } diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index ebcf33c16..c4b679362 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -108,6 +108,7 @@ "rangeFilters", ] + class ConsistencyLevel(str, BaseEnum): """The consistency levels when writing to Weaviate with replication enabled. diff --git a/weaviate/collections/config/async_.pyi b/weaviate/collections/config/async_.pyi index 3b07f55c6..61ee09fdd 100644 --- a/weaviate/collections/config/async_.pyi +++ b/weaviate/collections/config/async_.pyi @@ -5,6 +5,7 @@ from typing_extensions import deprecated from weaviate.collections.classes.config import ( CollectionConfig, CollectionConfigSimple, + IndexName, Property, ReferenceProperty, ShardStatus, @@ -82,3 +83,4 @@ class _ConfigCollectionAsync(_ConfigCollectionExecutor[ConnectionAsync]): async def add_vector( self, *, vector_config: Union[_VectorConfigCreate, List[_VectorConfigCreate]] ) -> None: ... + async def delete_property_index(self, property_name: str, index_name: IndexName) -> bool: ... diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index cba39cc60..60d31cfa5 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -53,7 +53,11 @@ from weaviate.exceptions import ( WeaviateInvalidInputError, ) -from weaviate.util import _capitalize_first_letter, _decode_json_response_dict, _decode_json_response_list +from weaviate.util import ( + _capitalize_first_letter, + _decode_json_response_dict, + _decode_json_response_list, +) from weaviate.validator import _validate_input, _ValidateArgument from weaviate.warnings import _Warnings @@ -584,31 +588,34 @@ async def _execute() -> None: return executor.result(resp(schema)) def delete_property_index( - self, - property: str, - index_name: IndexName, - ) -> executor.Result[bool]: # DNJ TODO - confirm output - """ # DNJ TODO - Docstring for delete_property_index - - :param self: Description - :param name: Description - :type name: str - :param property: Description - :type property: str - :param index_name: Description - :type index_name: IndexName - :return: Description - :rtype: Result[None] + self, + property_name: str, + index_name: IndexName, + ) -> executor.Result[bool]: + """Delete a property index from the collection in Weaviate. + + This is a destructive operation. The index will + need to be regenerated if you wish to use it again. + + Args: + property_name: The property name from which to delete the index. + index_name: The type of the index to delete. + + Raises: + weaviate.exceptions.WeaviateConnectionError: If the network connection to Weaviate fails. + weaviate.exceptions.UnexpectedStatusCodeError: If Weaviate reports a non-OK status. + weaviate.exceptions.WeaviateInvalidInputError: If the property or index does not exist. """ - _validate_input([_ValidateArgument(expected=[str], name="property", value=property)]) - _validate_input([_ValidateArgument(expected=[str], name="index_name", value=index_name)]) + _validate_input( + [_ValidateArgument(expected=[str], name="property_name", value=property_name)] + ) + _validate_input([_ValidateArgument(expected=[str], name="index_name", value=index_name)]) path = ( f"/schema/{_capitalize_first_letter(self._name)}" + f"/properties/{property}" + f"/index/{index_name}" ) - + def resp(res: Response) -> bool: return res.status_code == 200 @@ -616,6 +623,6 @@ def resp(res: Response) -> bool: response_callback=resp, method=self._connection.delete, path=path, - error_msg="Property may not exist.", # DNJ TODO - find all error states + error_msg="Property may not exist.", # DNJ TODO - find all error states status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), - ) \ No newline at end of file + ) diff --git a/weaviate/collections/config/sync.pyi b/weaviate/collections/config/sync.pyi index 21fd705ac..8aafc32a2 100644 --- a/weaviate/collections/config/sync.pyi +++ b/weaviate/collections/config/sync.pyi @@ -5,6 +5,7 @@ from typing_extensions import deprecated from weaviate.collections.classes.config import ( CollectionConfig, CollectionConfigSimple, + IndexName, Property, ReferenceProperty, ShardStatus, @@ -80,3 +81,4 @@ class _ConfigCollection(_ConfigCollectionExecutor[ConnectionSync]): def add_vector( self, *, vector_config: Union[_VectorConfigCreate, List[_VectorConfigCreate]] ) -> None: ... + def delete_property_index(self, property_name: str, index_name: IndexName) -> bool: ... From b1ff44ca575f5facfcc91e2465bb10f7b83d4697 Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 11:46:56 -0800 Subject: [PATCH 05/13] test passing locally --- integration/test_collection_config.py | 53 ++++++++++++++++++++++++- weaviate/collections/config/executor.py | 2 +- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 33e4e8d42..4076135d0 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1953,6 +1953,55 @@ def test_object_ttl_update(collection_factory: CollectionFactory) -> None: @pytest.mark.parametrize("index_name", ["filterable", "searchable", "rangeFilters"]) -def test_delete_property_index(index_name, collection_factory: CollectionFactory) -> None: +def test_delete_property_index(index_name: str, collection_factory: CollectionFactory) -> None: """Test delete index works for each index type.""" - pass + collection_dummy = collection_factory("dummy") + if ( + index_name == "rangeFilters" + and collection_dummy._connection._weaviate_version.is_lower_than(1, 36, 0) + ): + pytest.skip("delete property index not supported before 1.36.0") + if index_name == "filterable" or index_name == "searchable": + _data_type = DataType.TEXT + _index_range_filters = False + _index_searchable = True + _index_filterable = True + else: + _data_type = DataType.DATE + _index_range_filters = True + _index_searchable = False + _index_filterable = True + collection = collection_factory( + properties=[ + Property( + name="indexed_prop", + data_type=_data_type, + index_range_filters=_index_range_filters, + index_searchable=_index_searchable, + index_filterable=_index_filterable, + ) + ], + ) + config = collection.config.get() + assert config.properties[0].index_filterable is _index_filterable + assert config.properties[0].index_searchable is _index_searchable + assert config.properties[0].index_range_filters is _index_range_filters + + with pytest.raises(weaviate.exceptions.UnexpectedStatusCodeError): + collection.config.delete_property_index("does_not_exist", index_name) # type: ignore[arg-type] + + collection.config.delete_property_index("indexed_prop", index_name) # type: ignore[arg-type] + + config = collection.config.get() + if index_name == "filterable": + assert config.properties[0].index_filterable is False + assert config.properties[0].index_searchable is _index_searchable + assert config.properties[0].index_range_filters is _index_range_filters + elif index_name == "searchable": + assert config.properties[0].index_searchable is False + assert config.properties[0].index_filterable is _index_filterable + assert config.properties[0].index_range_filters is _index_range_filters + elif index_name == "rangeFilters": + assert config.properties[0].index_range_filters is False + assert config.properties[0].index_searchable is _index_searchable + assert config.properties[0].index_filterable is _index_filterable diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index 60d31cfa5..b886a93ae 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -612,7 +612,7 @@ def delete_property_index( _validate_input([_ValidateArgument(expected=[str], name="index_name", value=index_name)]) path = ( f"/schema/{_capitalize_first_letter(self._name)}" - + f"/properties/{property}" + + f"/properties/{property_name}" + f"/index/{index_name}" ) From 52675cd39e3722f4f02cb9f1d7b48800fc57c97f Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 12:30:24 -0800 Subject: [PATCH 06/13] use rc version in tests for 36 --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a84687f1e..f0f34e090 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -27,6 +27,7 @@ env: WEAVIATE_133: 1.33.10 WEAVIATE_134: 1.34.5 WEAVIATE_135: 1.35.0 + weaviate_136: 1.36.0-rc.0 jobs: lint-and-format: From 9a8039f5b783416c653c8dfe25bda4f1510d1b39 Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 12:34:05 -0800 Subject: [PATCH 07/13] remove TODO and conflict --- .github/workflows/main.yaml | 10 +--------- weaviate/collections/config/executor.py | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d0f5da323..760aa9a5b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -22,21 +22,13 @@ env: WEAVIATE_128: 1.28.16 WEAVIATE_129: 1.29.11 WEAVIATE_130: 1.30.22 -<<<<<<< djanicek/drop-prop-index WEAVIATE_131: 1.31.20 WEAVIATE_132: 1.32.23 WEAVIATE_133: 1.33.10 WEAVIATE_134: 1.34.5 WEAVIATE_135: 1.35.0 weaviate_136: 1.36.0-rc.0 -======= - WEAVIATE_131: 1.31.22 - WEAVIATE_132: 1.32.26 - WEAVIATE_133: 1.33.11 - WEAVIATE_134: 1.34.8 - WEAVIATE_135: 1.35.2 - WEAVIATE_136: 1.36.0-dev-35d0c3a ->>>>>>> dev/1.36 + jobs: lint-and-format: diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index b886a93ae..4f4fb2c91 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -623,6 +623,6 @@ def resp(res: Response) -> bool: response_callback=resp, method=self._connection.delete, path=path, - error_msg="Property may not exist.", # DNJ TODO - find all error states + error_msg="Property may not exist.", status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), ) From 198b3fed0489f9c021c37205990022db7f994eac Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 12:37:06 -0800 Subject: [PATCH 08/13] fix version typo --- .github/workflows/main.yaml | 2 +- integration/test_collection_config.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 760aa9a5b..03b86c856 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -27,7 +27,7 @@ env: WEAVIATE_133: 1.33.10 WEAVIATE_134: 1.34.5 WEAVIATE_135: 1.35.0 - weaviate_136: 1.36.0-rc.0 + WEAVIATE_136: 1.36.0-rc.0 jobs: diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 4076135d0..c7ac051e9 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1971,6 +1971,7 @@ def test_delete_property_index(index_name: str, collection_factory: CollectionFa _index_range_filters = True _index_searchable = False _index_filterable = True + collection = collection_factory( properties=[ Property( From 5add7b7ef20e533ecde1542e02a1e04f19dcd461 Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 12:38:08 -0800 Subject: [PATCH 09/13] trigger tests --- weaviate/collections/config/executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index 4f4fb2c91..0a7bf1a49 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -610,6 +610,7 @@ def delete_property_index( [_ValidateArgument(expected=[str], name="property_name", value=property_name)] ) _validate_input([_ValidateArgument(expected=[str], name="index_name", value=index_name)]) + path = ( f"/schema/{_capitalize_first_letter(self._name)}" + f"/properties/{property_name}" @@ -623,6 +624,6 @@ def resp(res: Response) -> bool: response_callback=resp, method=self._connection.delete, path=path, - error_msg="Property may not exist.", + error_msg="Property may not exist", status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), ) From c3af9b43e303b98e00198286aeac30fb720aba1b Mon Sep 17 00:00:00 2001 From: DanielJanicek Date: Tue, 17 Feb 2026 12:55:06 -0800 Subject: [PATCH 10/13] fix version check --- integration/test_collection_config.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index c7ac051e9..629310359 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1956,11 +1956,9 @@ def test_object_ttl_update(collection_factory: CollectionFactory) -> None: def test_delete_property_index(index_name: str, collection_factory: CollectionFactory) -> None: """Test delete index works for each index type.""" collection_dummy = collection_factory("dummy") - if ( - index_name == "rangeFilters" - and collection_dummy._connection._weaviate_version.is_lower_than(1, 36, 0) - ): + if collection_dummy._connection._weaviate_version.is_lower_than(1, 36, 0): pytest.skip("delete property index not supported before 1.36.0") + if index_name == "filterable" or index_name == "searchable": _data_type = DataType.TEXT _index_range_filters = False From 805938db9d01215077c7942e0e77e878a0eef33e Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Wed, 18 Feb 2026 10:02:58 +0000 Subject: [PATCH 11/13] Remove old poc impl --- weaviate/collections/collections/async_.pyi | 9 ---- weaviate/collections/collections/executor.py | 43 +------------------- weaviate/collections/collections/sync.pyi | 9 ---- 3 files changed, 1 insertion(+), 60 deletions(-) diff --git a/weaviate/collections/collections/async_.pyi b/weaviate/collections/collections/async_.pyi index e3c3d537e..4aeb7b491 100644 --- a/weaviate/collections/collections/async_.pyi +++ b/weaviate/collections/collections/async_.pyi @@ -1,6 +1,5 @@ from typing import Dict, List, Literal, Optional, Sequence, Type, Union, overload -from httpx import Response from typing_extensions import deprecated from weaviate.collections.classes.config import ( @@ -28,8 +27,6 @@ from weaviate.collections.collection import CollectionAsync from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect.v4 import ConnectionAsync -from weaviate.collections.collections.executor import IndexName - class _CollectionsAsync(_CollectionsBase[ConnectionAsync]): @overload async def create( @@ -125,12 +122,6 @@ class _CollectionsAsync(_CollectionsBase[ConnectionAsync]): async def delete_all(self) -> None: ... async def exists(self, name: str) -> bool: ... async def export_config(self, name: str) -> CollectionConfig: ... - def delete_property_index( - self, - name: str, - property: str, # DNJ TODO - accept property instance if exists - index_name: IndexName, - ) -> bool: ... # DNJ TODO something wrong with return here @overload async def list_all(self, simple: Literal[False]) -> Dict[str, CollectionConfig]: ... @overload diff --git a/weaviate/collections/collections/executor.py b/weaviate/collections/collections/executor.py index 9203e40c4..69b2baa64 100644 --- a/weaviate/collections/collections/executor.py +++ b/weaviate/collections/collections/executor.py @@ -1,5 +1,4 @@ import asyncio -from enum import Enum from typing import ( Awaitable, Dict, @@ -57,10 +56,7 @@ from weaviate.warnings import _Warnings CollectionType = TypeVar("CollectionType", Collection, CollectionAsync) -class IndexName(Enum): #DNJ TODO -somewhere else? - Searchable="searchable", - Filterable="filterable" - RangeFilters="rangeFilters" + class _CollectionsExecutor(Generic[ConnectionType]): def __init__(self, connection: ConnectionType): @@ -333,43 +329,6 @@ def resp(res: Response) -> bool: error_msg="Collection may not exist.", status_codes=_ExpectedStatusCodes(ok_in=[200, 404], error="collection exists"), ) - - def delete_property_index( - self, - name: str, - property: str, # DNJ TODO - accept property instance if exists - index_name: IndexName, - ) -> executor.Result[bool]: # DNJ TODO - confirm output - """ # DNJ TODO - Docstring for delete_property_index - - :param self: Description - :param name: Description - :type name: str - :param property: Description - :type property: str - :param index_name: Description - :type index_name: IndexName - :return: Description - :rtype: Result[None] - """ - _validate_input([_ValidateArgument(expected=[str], name="name", value=name)]) # DNJ TODO - path = ( - f"/schema/{_capitalize_first_letter(name)}" - + f"/properties/{property}" - + f"/index/{index_name.value}" - ) - - def resp(res: Response) -> bool: - return res.status_code == 200 - - return executor.execute( - response_callback=resp, - method=self._connection.delete, - path=path, - error_msg="Property may not exist.", # DNJ TODO - find all error states - status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), - ) def export_config( self, diff --git a/weaviate/collections/collections/sync.pyi b/weaviate/collections/collections/sync.pyi index 06a2270b6..22f3356e6 100644 --- a/weaviate/collections/collections/sync.pyi +++ b/weaviate/collections/collections/sync.pyi @@ -1,6 +1,5 @@ from typing import Dict, List, Literal, Optional, Sequence, Type, Union, overload -from httpx import Response from typing_extensions import deprecated from weaviate.collections.classes.config import ( @@ -28,8 +27,6 @@ from weaviate.collections.collection import Collection from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect.v4 import ConnectionSync -from weaviate.collections.collections.executor import IndexName - class _Collections(_CollectionsBase[ConnectionSync]): @overload def create( @@ -125,12 +122,6 @@ class _Collections(_CollectionsBase[ConnectionSync]): def delete_all(self) -> None: ... def exists(self, name: str) -> bool: ... def export_config(self, name: str) -> CollectionConfig: ... - def delete_property_index( - self, - name: str, - property: str, # DNJ TODO - accept property instance if exists - index_name: IndexName, - ) -> bool: ... @overload def list_all(self, simple: Literal[False]) -> Dict[str, CollectionConfig]: ... @overload From e72cf05b0a46dc3d4228a9575a5b1688108892c3 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Wed, 18 Feb 2026 10:03:38 +0000 Subject: [PATCH 12/13] Use `IndexName` is test types --- integration/test_collection_config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 629310359..b545b99cb 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -39,6 +39,7 @@ Tokenization, _NamedVectorConfigCreate, _VectorizerConfigCreate, + IndexName, ) from weaviate.collections.classes.tenants import Tenant from weaviate.exceptions import UnexpectedStatusCodeError, WeaviateInvalidInputError @@ -1953,7 +1954,9 @@ def test_object_ttl_update(collection_factory: CollectionFactory) -> None: @pytest.mark.parametrize("index_name", ["filterable", "searchable", "rangeFilters"]) -def test_delete_property_index(index_name: str, collection_factory: CollectionFactory) -> None: +def test_delete_property_index( + index_name: IndexName, collection_factory: CollectionFactory +) -> None: """Test delete index works for each index type.""" collection_dummy = collection_factory("dummy") if collection_dummy._connection._weaviate_version.is_lower_than(1, 36, 0): @@ -1987,9 +1990,9 @@ def test_delete_property_index(index_name: str, collection_factory: CollectionFa assert config.properties[0].index_range_filters is _index_range_filters with pytest.raises(weaviate.exceptions.UnexpectedStatusCodeError): - collection.config.delete_property_index("does_not_exist", index_name) # type: ignore[arg-type] + collection.config.delete_property_index("does_not_exist", index_name) - collection.config.delete_property_index("indexed_prop", index_name) # type: ignore[arg-type] + collection.config.delete_property_index("indexed_prop", index_name) config = collection.config.get() if index_name == "filterable": From 932137829da019ef5d031aa73df4c467a41b9553 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Wed, 18 Feb 2026 10:04:07 +0000 Subject: [PATCH 13/13] Re-export `IndexName` in `weaviate.classes` --- weaviate/classes/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weaviate/classes/config.py b/weaviate/classes/config.py index 651818de3..ce1faf993 100644 --- a/weaviate/classes/config.py +++ b/weaviate/classes/config.py @@ -3,6 +3,7 @@ ConsistencyLevel, DataType, GenerativeSearches, + IndexName, PQEncoderDistribution, PQEncoderType, Property, @@ -27,6 +28,7 @@ "Reconfigure", "DataType", "GenerativeSearches", + "IndexName", "Integrations", "Multi2VecField", "MultiVectorAggregation",