From 6e8d0e31774e26468df30624cf85a13388dfa2cf Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 18 Mar 2025 16:07:29 +0800 Subject: [PATCH] Fix: rank feat issue. (#6225) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/nlp/search.py | 1 + rag/utils/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rag/nlp/search.py b/rag/nlp/search.py index ba2ee3ffe..7604bf2c1 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -259,6 +259,7 @@ class Dealer: for i in search_res.ids: nor, denor = 0, 0 if not search_res.field[i].get(TAG_FLD): + rank_fea.append(0) continue for t, sc in eval(search_res.field[i].get(TAG_FLD, "{}")).items(): if t in query_rfea: diff --git a/rag/utils/__init__.py b/rag/utils/__init__.py index c9a007d1b..11a2f7db9 100644 --- a/rag/utils/__init__.py +++ b/rag/utils/__init__.py @@ -100,7 +100,7 @@ def clean_markdown_block(text): return text.strip() -def get_float(v: str | None): +def get_float(v: str | int | float | None): if v is None: return float('-inf') try: