Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

[Bug fix] fix bug found in regression when view chunks for document that not parsed in infinity, it would fail in UI (#14168)

Wang Qi96a23d2fd064
diff --git a/common/doc_store/infinity_conn_base.py b/common/doc_store/infinity_conn_base.py
index 35459aaf40..1336c92c5b 100644
--- a/common/doc_store/infinity_conn_base.py
+++ b/common/doc_store/infinity_conn_base.py
@@ -491,17 +491,29 @@ class InfinityConnectionBase(DocStoreConnection):
return len(res)
def get_doc_ids(self, res: tuple[pd.DataFrame, int] | pd.DataFrame) -> list[str]:
+ # Extract DataFrame from result
if isinstance(res, tuple):
- res = res[0]
- return list(res["id"])
+ df, count = res
+ if count == 0:
+ return []
+ else:
+ df = res
+ return list(df["id"])
@abstractmethod
def get_fields(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, fields: list[str]) -> dict[str, dict]:
raise NotImplementedError("Not implemented")
def get_highlight(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, keywords: list[str], field_name: str):
+ # Extract DataFrame from result
if isinstance(res, tuple):
- res = res[0]
+ df, _ = res
+ else:
+ df = res
+
+ if df.empty or field_name not in df.columns:
+ return {}
+
ans = {}
num_rows = len(res)
column_id = res["id"]