Skip to content
Open
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: 10 additions & 5 deletions weaviate/collections/classes/config_vector_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ class _VectorIndexConfigFlatCreate(_VectorIndexConfigCreate):

@staticmethod
def vector_index_type() -> VectorIndexType:
return VectorIndexType.FLAT
# Use a cached class-level constant to avoid repeatedly looking up the class attribute
if not hasattr(_VectorIndexConfigFlatCreate, "_VECTOR_INDEX_TYPE_FLAT"):
_VectorIndexConfigFlatCreate._VECTOR_INDEX_TYPE_FLAT = VectorIndexType.FLAT
return _VectorIndexConfigFlatCreate._VECTOR_INDEX_TYPE_FLAT


class _VectorIndexConfigHNSWUpdate(_VectorIndexConfigUpdate):
Expand Down Expand Up @@ -236,10 +239,12 @@ def merge_with_existing(self, schema: Dict[str, Any]) -> Dict[str, Any]:

Errors shadowing type occur if we want to use type as a field name.
"""
if self.type_ is not None:
schema["type"] = str(self.type_.value)
if self.distribution is not None:
schema["distribution"] = str(self.distribution.value)
type_ = self.type_
distribution = self.distribution
if type_ is not None:
schema["type"] = str(type_.value)
if distribution is not None:
schema["distribution"] = str(distribution.value)
return schema


Expand Down