update names of doc engine helper functions

This commit is contained in:
He Wang 2025-11-18 14:39:27 +08:00
parent 6e81cf2cbf
commit 08745e0304

View file

@ -1435,13 +1435,13 @@ class OBConnection(DocStoreConnection):
Helper functions for search result Helper functions for search result
""" """
def getTotal(self, res) -> int: def get_total(self, res) -> int:
return res.total return res.total
def getChunkIds(self, res) -> list[str]: def get_chunk_ids(self, res) -> list[str]:
return [row["id"] for row in res.chunks] return [row["id"] for row in res.chunks]
def getFields(self, res, fields: list[str]) -> dict[str, dict]: def get_fields(self, res, fields: list[str]) -> dict[str, dict]:
result = {} result = {}
for row in res.chunks: for row in res.chunks:
data = {} data = {}
@ -1511,7 +1511,7 @@ class OBConnection(DocStoreConnection):
last_pos = token_pos last_pos = token_pos
return re.sub(r'</em><em>', '', highlighted_txt) return re.sub(r'</em><em>', '', highlighted_txt)
def getHighlight(self, res, keywords: list[str], fieldnm: str): def get_highlight(self, res, keywords: list[str], fieldnm: str):
ans = {} ans = {}
if len(res.chunks) == 0 or len(keywords) == 0: if len(res.chunks) == 0 or len(keywords) == 0:
return ans return ans
@ -1527,7 +1527,7 @@ class OBConnection(DocStoreConnection):
ans[d["id"]] = highlighted_txt ans[d["id"]] = highlighted_txt
return ans return ans
def getAggregation(self, res, fieldnm: str): def get_aggregation(self, res, fieldnm: str):
if len(res.chunks) == 0: if len(res.chunks) == 0:
return [] return []