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:
buua436
2026-07-23 20:48:39 +08:00
committed by GitHub
parent a84d2ae3d2
commit 0c5732108a
5 changed files with 125 additions and 51 deletions

View File

@@ -8,6 +8,7 @@
"create_timestamp_flt": {"type": "float", "default": 0.0},
"img_id": {"type": "varchar", "default": ""},
"docnm": {"type": "varchar", "default": "", "analyzer": ["rag-coarse", "rag-fine"], "comment": "docnm_kwd, title_tks, title_sm_tks"},
"name": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"name_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"tag_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"important_kwd_empty_count": {"type": "integer", "default": 0},
@@ -43,9 +44,9 @@
"extra": {"type": "varchar", "default": ""},
"compile_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"source_chunk_ids": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"source_doc_ids": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"compilation_template_ids": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"source_chunk_ids": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"source_doc_ids": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"compilation_template_ids": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"compilation_template_kind_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"chunk_hash_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"input_hash_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
@@ -55,20 +56,20 @@
"skill_with_weight": {"type": "varchar", "default": ""},
"skill_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"children_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"doc_ids_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"doc_ids_kwd": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"slug_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"title_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"topic_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"page_type_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"entity_names_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"outlinks_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"related_kb_pages_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"entity_names_kwd": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"outlinks_kwd": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"related_kb_pages_kwd": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"type_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"from_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"to_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"rechunk_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"rechunked_from_template_id": {"type": "varchar", "default": ""},
"rechunked_from_chunk_ids": {"type": "varchar", "default": "", "analyzer": "whitespace-#"},
"rechunked_from_chunk_ids": {"type": "json", "default": "[]", "index_type": {"type": "secondary", "cardinality": "low"}},
"superseded_by_chunk_id": {"type": "varchar", "default": ""},
"doc_count_int": {"type": "integer", "default": 0},
"depth_int": {"type": "integer", "default": 0},