Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/collection/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,10 @@ def test_config_create_with_properties(
name="blob",
data_type=DataType.BLOB,
),
Property(
name="blob_hash",
data_type=DataType.BLOB_HASH,
),
Property(
name="phone_number",
data_type=DataType.PHONE_NUMBER,
Expand Down Expand Up @@ -1398,6 +1402,10 @@ def test_config_create_with_properties(
"dataType": ["blob"],
"name": "blob",
},
{
"dataType": ["blobHash"],
"name": "blob_hash",
},
{
"dataType": ["phoneNumber"],
"name": "phone_number",
Expand Down
2 changes: 2 additions & 0 deletions weaviate/collections/classes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class DataType(str, BaseEnum):
UUID_ARRAY: UUID array data type.
GEO_COORDINATES: Geo coordinates data type.
BLOB: Blob data type.
BLOB_HASH: Blob hash data type.
PHONE_NUMBER: Phone number data type.
OBJECT: Object data type.
OBJECT_ARRAY: Object array data type.
Expand All @@ -161,6 +162,7 @@ class DataType(str, BaseEnum):
UUID_ARRAY = "uuid[]"
GEO_COORDINATES = "geoCoordinates"
BLOB = "blob"
BLOB_HASH = "blobHash"
PHONE_NUMBER = "phoneNumber"
OBJECT = "object"
OBJECT_ARRAY = "object[]"
Expand Down
1 change: 1 addition & 0 deletions weaviate/collections/config/async_.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ class _ConfigCollectionAsync(_ConfigCollectionExecutor[ConnectionAsync]):
self, *, vector_config: Union[_VectorConfigCreate, List[_VectorConfigCreate]]
) -> None: ...
async def delete_property_index(self, property_name: str, index_name: IndexName) -> bool: ...
async def delete_vector_index(self, vector_name: str) -> bool: ...
38 changes: 38 additions & 0 deletions weaviate/collections/config/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,41 @@ def resp(res: Response) -> bool:
error_msg="Property may not exist",
status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"),
)

def delete_vector_index(
self,
vector_name: str,
) -> executor.Result[bool]:
"""Delete a vector 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:
vector_name: The name of the vector whose 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 vector does not exist.
"""
_validate_input(
[_ValidateArgument(expected=[str], name="vector_name", value=vector_name)]
)

path = (
f"/schema/{_capitalize_first_letter(self._name)}"
+ f"/vectors/{vector_name}"
+ "/index"
)

def resp(res: Response) -> bool:
return res.status_code == 200

return executor.execute(
response_callback=resp,
method=self._connection.delete,
path=path,
error_msg="Vector may not exist",
status_codes=_ExpectedStatusCodes(ok_in=[200], error="vector exists"),
)
1 change: 1 addition & 0 deletions weaviate/collections/config/sync.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ class _ConfigCollection(_ConfigCollectionExecutor[ConnectionSync]):
self, *, vector_config: Union[_VectorConfigCreate, List[_VectorConfigCreate]]
) -> None: ...
def delete_property_index(self, property_name: str, index_name: IndexName) -> bool: ...
def delete_vector_index(self, vector_name: str) -> bool: ...
Loading