James L
James L

Reputation: 31

Fuzzy search with Python Whoosh (Rank/Score Direct Hits higher than Fuzzy Hits)

I am having trouble with Fuzzy Queries giving higher relevance to Fuzzy Hit terms than Direct Match on Python Whoosh. Is there any existing options available within the library to score direct matches higher? or I have to separately code it (i.e.do both Direct Query and Fuzzy Query and rank the text one higher...)? Thanks for the advice.

Upvotes: 0

Views: 538

Answers (1)

James L
James L

Reputation: 31

To answer my own question, I found a crude solution via stacking of queries:

  1. Perform 2 separate searches: (1) Query for direct/exact match, (2) Fuzzy Query.
  2. Then, do any "extend(results)" method to stack the (1) result above (2) result. The method will handle duplicates too. See: https://whoosh.readthedocs.io/en/latest/api/searching.html

However, the scores still remain unchanged.

Upvotes: 1

Related Questions