mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-03 01:01:56 +08:00
Get ROW_ID from search() in Infinity (#13901)
### What problem does this PR solve? 1. Search() in Infinity can return row_id now 2. To Get ROW_ID from search(), refer to handling of retrieval_test. example ``` $ curl -s -X POST "http://localhost:$PORT/v1/chunk/retrieval_test" -H "Authorization: $TOKEN" -H "Content-Type: application/json" -d '{"kb_id": "4fcd01582ca911f1954184ba59049aa3", "question": "曹操"}' ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -92,7 +92,7 @@ class Dealer:
|
||||
["docnm_kwd", "content_ltks", "kb_id", "img_id", "title_tks", "important_kwd", "position_int",
|
||||
"doc_id", "page_num_int", "top_int", "create_timestamp_flt", "knowledge_graph_kwd",
|
||||
"question_kwd", "question_tks", "doc_type_kwd",
|
||||
"available_int", "content_with_weight", "mom_id", PAGERANK_FLD, TAG_FLD])
|
||||
"available_int", "content_with_weight", "mom_id", PAGERANK_FLD, TAG_FLD, "row_id()"])
|
||||
kwds = set([])
|
||||
|
||||
qst = req.get("question", "")
|
||||
@@ -486,6 +486,7 @@ class Dealer:
|
||||
"positions": position_int,
|
||||
"doc_type_kwd": chunk.get("doc_type_kwd", ""),
|
||||
"mom_id": chunk.get("mom_id", ""),
|
||||
"row_id": chunk.get("row_id()"),
|
||||
}
|
||||
if highlight and sres.highlight:
|
||||
if id in sres.highlight:
|
||||
|
||||
@@ -639,6 +639,9 @@ class InfinityConnection(InfinityConnectionBase):
|
||||
res[field] = res["authors"]
|
||||
|
||||
column_map = {col.lower(): col for col in res.columns}
|
||||
# row_id() is returned by infinity as "row_id", add mapping for lookup
|
||||
if "row_id()" in fields_all and "row_id" in column_map:
|
||||
column_map["row_id()"] = column_map["row_id"]
|
||||
matched_columns = {column_map[col.lower()]: col for col in fields_all if col.lower() in column_map}
|
||||
none_columns = [col for col in fields_all if col.lower() not in column_map]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user