Merge branch 'main' into add-Memgraph-graph-db
This commit is contained in:
commit
8ce2223e58
1 changed files with 16 additions and 6 deletions
|
|
@ -444,7 +444,18 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
||||||
for field in collection_info.get("fields", []):
|
for field in collection_info.get("fields", []):
|
||||||
if field.get("name") == "vector":
|
if field.get("name") == "vector":
|
||||||
field_type = field.get("type")
|
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")
|
existing_dimension = field.get("params", {}).get("dim")
|
||||||
|
|
||||||
if existing_dimension != current_dimension:
|
if existing_dimension != current_dimension:
|
||||||
|
|
@ -531,7 +542,9 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
||||||
# 2. Check schema compatibility
|
# 2. Check schema compatibility
|
||||||
self._check_schema_compatibility(collection_info)
|
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:
|
except Exception as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
@ -571,16 +584,13 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
||||||
# Check if our specific collection exists
|
# Check if our specific collection exists
|
||||||
collection_exists = self._client.has_collection(self.namespace)
|
collection_exists = self._client.has_collection(self.namespace)
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Collection '{self.namespace}' exists check: {collection_exists}"
|
f"VectorDB collection '{self.namespace}' exists check: {collection_exists}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if collection_exists:
|
if collection_exists:
|
||||||
# Double-check by trying to describe the collection
|
# Double-check by trying to describe the collection
|
||||||
try:
|
try:
|
||||||
self._client.describe_collection(self.namespace)
|
self._client.describe_collection(self.namespace)
|
||||||
logger.info(
|
|
||||||
f"Collection '{self.namespace}' confirmed to exist, validating compatibility..."
|
|
||||||
)
|
|
||||||
self._validate_collection_compatibility()
|
self._validate_collection_compatibility()
|
||||||
# Ensure the collection is loaded after validation
|
# Ensure the collection is loaded after validation
|
||||||
self._ensure_collection_loaded()
|
self._ensure_collection_loaded()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue