Merge branch 'main' into add-Memgraph-graph-db

This commit is contained in:
yangdx 2025-07-05 07:56:14 +08:00
commit 8ce2223e58

View File

@ -444,7 +444,18 @@ class MilvusVectorDBStorage(BaseVectorStorage):
for field in collection_info.get("fields", []):
if field.get("name") == "vector":
field_type = field.get("type")
if field_type in ["FloatVector", "FLOAT_VECTOR"]:
# Extract type name from DataType enum or string
type_name = None
if hasattr(field_type, "name"):
type_name = field_type.name
elif isinstance(field_type, str):
type_name = field_type
else:
type_name = str(field_type)
# Check if it's a vector type (supports multiple formats)
if type_name in ["FloatVector", "FLOAT_VECTOR"]:
existing_dimension = field.get("params", {}).get("dim")
if existing_dimension != current_dimension:
@ -531,7 +542,9 @@ class MilvusVectorDBStorage(BaseVectorStorage):
# 2. Check schema compatibility
self._check_schema_compatibility(collection_info)
logger.info(f"Collection {self.namespace} compatibility validation passed")
logger.info(
f"VectorDB Collection '{self.namespace}' compatibility validation passed"
)
except Exception as e:
logger.error(
@ -571,16 +584,13 @@ class MilvusVectorDBStorage(BaseVectorStorage):
# Check if our specific collection exists
collection_exists = self._client.has_collection(self.namespace)
logger.info(
f"Collection '{self.namespace}' exists check: {collection_exists}"
f"VectorDB collection '{self.namespace}' exists check: {collection_exists}"
)
if collection_exists:
# Double-check by trying to describe the collection
try:
self._client.describe_collection(self.namespace)
logger.info(
f"Collection '{self.namespace}' confirmed to exist, validating compatibility..."
)
self._validate_collection_compatibility()
# Ensure the collection is loaded after validation
self._ensure_collection_loaded()