fix(vector-stores): improve milvus wildcard search (#6187)

This commit is contained in:
Qun
2026-07-10 20:36:22 +05:30
committed by GitHub
parent 8488abe603
commit 1d383c4ee2
2 changed files with 12 additions and 1 deletions
+4 -1
View File
@@ -159,7 +159,10 @@ class MilvusDB(VectorStoreBase):
for key, value in filters.items():
if not self._SAFE_FILTER_KEY.match(key):
raise ValueError(f"Invalid filter key: {key!r}")
if isinstance(value, str):
if value == "*":
# Wildcard - match any value (MilvusDB doesn't have direct wildcard, so we skip this filter)
continue
elif isinstance(value, str):
escaped = value.replace("\\", "\\\\").replace('"', '\\"')
operands.append(f'(metadata["{key}"] == "{escaped}")')
elif isinstance(value, (int, float, bool)):