diff --git a/lightrag/kg/milvus_impl.py b/lightrag/kg/milvus_impl.py index 2226784f..c64239a9 100644 --- a/lightrag/kg/milvus_impl.py +++ b/lightrag/kg/milvus_impl.py @@ -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()