Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Clear deleted scores at the end of common-term merging

LimbC-C9f9b32e0701a
diff --git a/src/python/txtai/scoring/terms.py b/src/python/txtai/scoring/terms.py
index 196b8f0b..65d77a39 100644
--- a/src/python/txtai/scoring/terms.py
+++ b/src/python/txtai/scoring/terms.py
@@ -523,9 +523,6 @@ class Terms:
if not hasscores:
matches = self.candidates(scores, topn)
- # Common term scores can restore deleted candidates; clear them before ranking.
- scores[self.deletes] = 0
-
# Reorder matches using updated scores
matches = matches[np.argsort(-scores[matches])]
@@ -561,6 +558,9 @@ class Terms:
# Update scores
scores[uids] += freq * weights
+ # Common term scores can restore deleted candidates; clear them after merging.
+ scores[self.deletes] = 0
+
def candidates(self, scores, topn):
"""
Gets the topn scored candidates. This method ignores deleted documents.