From e5a8b2368497ba7a8dd4b3813e40e287803e3f72 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 14 Mar 2025 17:35:57 +0800 Subject: [PATCH] Fix: empty tag field issue. (#6103) ### What problem does this PR solve? #6102 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/nlp/search.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rag/nlp/search.py b/rag/nlp/search.py index 86416cd49..1e83969e4 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -258,6 +258,8 @@ class Dealer: q_denor = np.sqrt(np.sum([s*s for t,s in query_rfea.items() if t != PAGERANK_FLD])) for i in search_res.ids: nor, denor = 0, 0 + if not search_res.field[i].get(TAG_FLD): + continue for t, sc in eval(search_res.field[i].get(TAG_FLD, "{}")).items(): if t in query_rfea: nor += query_rfea[t] * sc