Merge branch 'milvus-for-nullable'
Browse files- lightrag/kg/milvus_impl.py +0 -23
lightrag/kg/milvus_impl.py
CHANGED
@@ -44,12 +44,6 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|
44 |
max_length=512,
|
45 |
nullable=True,
|
46 |
),
|
47 |
-
FieldSchema(
|
48 |
-
name="entity_type",
|
49 |
-
dtype=DataType.VARCHAR,
|
50 |
-
max_length=128,
|
51 |
-
nullable=True,
|
52 |
-
),
|
53 |
FieldSchema(
|
54 |
name="file_path",
|
55 |
dtype=DataType.VARCHAR,
|
@@ -67,7 +61,6 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|
67 |
FieldSchema(
|
68 |
name="tgt_id", dtype=DataType.VARCHAR, max_length=512, nullable=True
|
69 |
),
|
70 |
-
FieldSchema(name="weight", dtype=DataType.DOUBLE, nullable=True),
|
71 |
FieldSchema(
|
72 |
name="file_path",
|
73 |
dtype=DataType.VARCHAR,
|
@@ -227,19 +220,6 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|
227 |
logger.debug(f"IndexParams method failed for entity_name: {e}")
|
228 |
self._create_scalar_index_fallback("entity_name", "INVERTED")
|
229 |
|
230 |
-
try:
|
231 |
-
entity_type_index = self._get_index_params()
|
232 |
-
entity_type_index.add_index(
|
233 |
-
field_name="entity_type", index_type="INVERTED"
|
234 |
-
)
|
235 |
-
self._client.create_index(
|
236 |
-
collection_name=self.namespace,
|
237 |
-
index_params=entity_type_index,
|
238 |
-
)
|
239 |
-
except Exception as e:
|
240 |
-
logger.debug(f"IndexParams method failed for entity_type: {e}")
|
241 |
-
self._create_scalar_index_fallback("entity_type", "INVERTED")
|
242 |
-
|
243 |
elif "relationships" in self.namespace.lower():
|
244 |
# Create indexes for relationship fields
|
245 |
try:
|
@@ -294,7 +274,6 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|
294 |
# Create scalar indexes using fallback
|
295 |
if "entities" in self.namespace.lower():
|
296 |
self._create_scalar_index_fallback("entity_name", "INVERTED")
|
297 |
-
self._create_scalar_index_fallback("entity_type", "INVERTED")
|
298 |
elif "relationships" in self.namespace.lower():
|
299 |
self._create_scalar_index_fallback("src_id", "INVERTED")
|
300 |
self._create_scalar_index_fallback("tgt_id", "INVERTED")
|
@@ -320,14 +299,12 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|
320 |
if "entities" in self.namespace.lower():
|
321 |
specific_fields = {
|
322 |
"entity_name": {"type": "VarChar"},
|
323 |
-
"entity_type": {"type": "VarChar"},
|
324 |
"file_path": {"type": "VarChar"},
|
325 |
}
|
326 |
elif "relationships" in self.namespace.lower():
|
327 |
specific_fields = {
|
328 |
"src_id": {"type": "VarChar"},
|
329 |
"tgt_id": {"type": "VarChar"},
|
330 |
-
"weight": {"type": "Double"},
|
331 |
"file_path": {"type": "VarChar"},
|
332 |
}
|
333 |
elif "chunks" in self.namespace.lower():
|
|
|
44 |
max_length=512,
|
45 |
nullable=True,
|
46 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
FieldSchema(
|
48 |
name="file_path",
|
49 |
dtype=DataType.VARCHAR,
|
|
|
61 |
FieldSchema(
|
62 |
name="tgt_id", dtype=DataType.VARCHAR, max_length=512, nullable=True
|
63 |
),
|
|
|
64 |
FieldSchema(
|
65 |
name="file_path",
|
66 |
dtype=DataType.VARCHAR,
|
|
|
220 |
logger.debug(f"IndexParams method failed for entity_name: {e}")
|
221 |
self._create_scalar_index_fallback("entity_name", "INVERTED")
|
222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
elif "relationships" in self.namespace.lower():
|
224 |
# Create indexes for relationship fields
|
225 |
try:
|
|
|
274 |
# Create scalar indexes using fallback
|
275 |
if "entities" in self.namespace.lower():
|
276 |
self._create_scalar_index_fallback("entity_name", "INVERTED")
|
|
|
277 |
elif "relationships" in self.namespace.lower():
|
278 |
self._create_scalar_index_fallback("src_id", "INVERTED")
|
279 |
self._create_scalar_index_fallback("tgt_id", "INVERTED")
|
|
|
299 |
if "entities" in self.namespace.lower():
|
300 |
specific_fields = {
|
301 |
"entity_name": {"type": "VarChar"},
|
|
|
302 |
"file_path": {"type": "VarChar"},
|
303 |
}
|
304 |
elif "relationships" in self.namespace.lower():
|
305 |
specific_fields = {
|
306 |
"src_id": {"type": "VarChar"},
|
307 |
"tgt_id": {"type": "VarChar"},
|
|
|
308 |
"file_path": {"type": "VarChar"},
|
309 |
}
|
310 |
elif "chunks" in self.namespace.lower():
|