From e0bb6093b03b632fcee6f25eb27766be9799bf7a Mon Sep 17 00:00:00 2001 From: xuewei <728857235@qq.com> Date: Wed, 16 Jul 2025 21:59:17 +0800 Subject: [PATCH] Fix Milvus DataNotMatchException --- lightrag/lightrag.py | 4 ++-- lightrag/operate.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 092e06eb..0d072e61 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -457,13 +457,13 @@ class LightRAG: namespace=NameSpace.VECTOR_STORE_ENTITIES, workspace=self.workspace, embedding_func=self.embedding_func, - meta_fields={"entity_name", "source_id", "content", "file_path"}, + meta_fields={"entity_name", "source_id", "content", "file_path", "entity_type"}, ) self.relationships_vdb: BaseVectorStorage = self.vector_db_storage_cls( # type: ignore namespace=NameSpace.VECTOR_STORE_RELATIONSHIPS, workspace=self.workspace, embedding_func=self.embedding_func, - meta_fields={"src_id", "tgt_id", "source_id", "content", "file_path"}, + meta_fields={"src_id", "tgt_id", "source_id", "content", "file_path", "weight"}, ) self.chunks_vdb: BaseVectorStorage = self.vector_db_storage_cls( # type: ignore namespace=NameSpace.VECTOR_STORE_CHUNKS, diff --git a/lightrag/operate.py b/lightrag/operate.py index e3456d92..1eac8357 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -1284,6 +1284,7 @@ async def merge_nodes_and_edges( "content": f"{edge_data['src_id']}\t{edge_data['tgt_id']}\n{edge_data['keywords']}\n{edge_data['description']}", "source_id": edge_data["source_id"], "file_path": edge_data.get("file_path", "unknown_source"), + "weight": 0 } } await relationships_vdb.upsert(data_for_vdb)