From 96a23d2fd064d9ad9106f694cf4bee51c4408d03 Mon Sep 17 00:00:00 2001 From: Wang Qi Date: Fri, 17 Apr 2026 09:51:23 +0800 Subject: [PATCH] [Bug fix] fix bug found in regression when view chunks for document that not parsed in infinity, it would fail in UI (#14168) ### What problem does this PR solve? See title, the fail image: 20260416-205718 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- common/doc_store/infinity_conn_base.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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"]