Skip to content
Merged
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
15 changes: 0 additions & 15 deletions python/zvec/model/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@

__all__ = ["Collection"]

_VECTOR_INDEX_TYPES = (
HnswIndexParam,
HnswRabitqIndexParam,
IVFIndexParam,
FlatIndexParam,
)


class Collection:
"""Represents an opened collection in Zvec.
Expand Down Expand Up @@ -133,15 +126,7 @@ def create_index(
option (Optional[IndexOption], optional): Index creation options.
Defaults to ``IndexOption()``.

Raises:
ValueError: If a vector index is applied to a non-vector field.
"""
if index_param in _VECTOR_INDEX_TYPES and not self.schema.vector(field_name):
supported_types = ", ".join(cls.__name__ for cls in _VECTOR_INDEX_TYPES)
raise ValueError(
f"Cannot apply vector index to non-vector field '{field_name}'. "
f"The field must be of vector type to use index types like {supported_types}."
)
self._obj.CreateIndex(field_name, index_param, option)
self._schema = CollectionSchema._from_core(self._obj.Schema())

Expand Down
Loading