mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-11 19:09:01 +08:00
Fix chunk creation using Infinity (#3763)
### What problem does this PR solve? 1. Store error type in Infinity 2. position list value read from Infinity isn't correct. Fix issue: #3729 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Signed-off-by: jinhai <haijin.chn@gmail.com>
This commit is contained in:
parent
a19210daf1
commit
d00297a763
@ -60,6 +60,11 @@ def list_chunk():
|
||||
sres = settings.retrievaler.search(query, search.index_name(tenant_id), kb_ids, highlight=True)
|
||||
res = {"total": sres.total, "chunks": [], "doc": doc.to_dict()}
|
||||
for id in sres.ids:
|
||||
chunk_elem = sres.field[id]
|
||||
if 'position_list' in chunk_elem:
|
||||
if isinstance(chunk_elem["position_list"], str):
|
||||
chunk_elem.pop('position_list') # Infinity will store position list as empty str
|
||||
|
||||
d = {
|
||||
"chunk_id": id,
|
||||
"content_with_weight": rmSpace(sres.highlight[id]) if question and id in sres.highlight else sres.field[
|
||||
|
@ -328,7 +328,7 @@ class InfinityConnection(DocStoreConnection):
|
||||
table_instance = db_instance.get_table(table_name)
|
||||
except InfinityException as e:
|
||||
# src/common/status.cppm, kTableNotExist = 3022
|
||||
if e.error_code != 3022:
|
||||
if e.error_code != ErrorCode.TABLE_NOT_EXIST:
|
||||
raise
|
||||
vector_size = 0
|
||||
patt = re.compile(r"q_(?P<vector_size>\d+)_vec")
|
||||
@ -348,6 +348,9 @@ class InfinityConnection(DocStoreConnection):
|
||||
for k, v in d.items():
|
||||
if k.endswith("_kwd") and isinstance(v, list):
|
||||
d[k] = " ".join(v)
|
||||
if k == 'kb_id':
|
||||
if isinstance(d[k], list):
|
||||
d[k] = d[k][0] # since d[k] is a list, but we need a str
|
||||
ids = ["'{}'".format(d["id"]) for d in documents]
|
||||
str_ids = ", ".join(ids)
|
||||
str_filter = f"id IN ({str_ids})"
|
||||
|
Loading…
x
Reference in New Issue
Block a user