Skip to content

Commit

Permalink
PB-1167: change fuzzy search ranker from sph04 to bm25
Browse files Browse the repository at this point in the history
with the introduction of the quorum operator it makes sense to change
the ranker/weighting to the bm25 method.

This should generate more natural order of the search results by
applying the same weight to all the keywords in the search Text
  • Loading branch information
ltclm committed Dec 17, 2024
1 parent 4988f9f commit 26fad6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ def _fuzzy_search(self, searchTextFinal):
logger.debug("Search fuzzy; searchText=%s", searchTextFinal)
# We use different ranking for fuzzy search
# For ranking modes, see http://sphinxsearch.com/docs/current.html#weighting
self.sphinx.SetRankingMode(sphinxapi.SPH_RANK_SPH04)
self.sphinx.SetRankingMode(sphinxapi.SPH_RANK_BM25)
# Only include results with a certain weight. This might need tweaking
# with the quorum operator lesser weights should be added to the results for the better
# support of fuzziness
self.sphinx.SetFilterRange('@weight', 2500, 2**32 - 1)
self.sphinx.SetFilterRange('@weight', 1000, 2**32 - 1)
try:
if self.typeInfo in ('locations'):
results = self.sphinx.Query(searchTextFinal, index='swisssearch_fuzzy')
Expand Down

0 comments on commit 26fad6e

Please sign in to comment.