Skip to content

Commit

Permalink
bm25 change for testing comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
capjamesg committed Nov 18, 2024
1 parent e6f076c commit 00a2cce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jamesql/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,12 +945,12 @@ def search(
positions = set([x - i for x in word_pos[term]])
first_word_pos &= positions

# if first_word_pos and field != "title_lower":
# doc["_score"] += (
# len(first_word_pos) + 1
# ) # * len(set(word_pos[term_queries[0]]))
# elif first_word_pos and field == "title_lower":
# doc["_score"] *= 2 + len(first_word_pos)
if first_word_pos and field != "title_lower":
doc["_score"] += (
len(first_word_pos) + 1
) # * len(set(word_pos[term_queries[0]]))
elif first_word_pos and field == "title_lower":
doc["_score"] *= 2 + len(first_word_pos)

# sort by doc score
results = sorted(results, key=lambda x: x.get("_score", 0), reverse=True)
Expand Down

0 comments on commit 00a2cce

Please sign in to comment.