mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 01:43:27 +08:00
fix: support Infinity knowledge compilation (#17288)
### What problem does this PR solve? Fix Infinity compatibility issues in knowledge compilation. This change: - Stores compilation source ID lists as JSON arrays in Infinity. - Parses JSON array fields when reading compiled documents. - Uses `json_contains` for filtering JSON array fields. - Adds the missing `name` column to the Infinity mapping. - Updates dataset navigation KNN search to use the unified `MatchDenseExpr` interface. - Handles unavailable embeddings without querying an invalid `q_0_vec` field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -304,7 +304,24 @@ class InfinityConnectionBase(DocStoreConnection):
|
||||
continue
|
||||
if not v:
|
||||
continue
|
||||
if self.field_keyword(k):
|
||||
if k in {
|
||||
"source_chunk_ids",
|
||||
"source_doc_ids",
|
||||
"compilation_template_ids",
|
||||
"doc_ids_kwd",
|
||||
"entity_names_kwd",
|
||||
"outlinks_kwd",
|
||||
"related_kb_pages_kwd",
|
||||
"rechunked_from_chunk_ids",
|
||||
}:
|
||||
values = v if isinstance(v, list) else [v]
|
||||
json_conditions = []
|
||||
for item in values:
|
||||
literal = json.dumps(item, ensure_ascii=False).replace("'", "''")
|
||||
json_conditions.append(f"json_contains({k}, '{literal}')")
|
||||
if json_conditions:
|
||||
cond.append("(" + " or ".join(json_conditions) + ")")
|
||||
elif self.field_keyword(k):
|
||||
if isinstance(v, list):
|
||||
inCond = list()
|
||||
for item in v:
|
||||
|
||||
Reference in New Issue
Block a user