Skip to content

Commit

Permalink
Better typeahead sorting for rare words
Browse files Browse the repository at this point in the history
Not all words have a rel_importance value. For those, we should assume a
low relative importance. Before, the information from max_score got lost
because it was multiplied wit the rel_importance value.

This has even more impact than it should have, since the current
deployment misses many rel_importance values due to
karlb/wikdict-gen@4058c97 .

Closes #8.
  • Loading branch information
karlb committed Nov 14, 2021
1 parent 383ed5e commit 3bd80b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wikdict_web/typeahead.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_typeahead_data(from_lang, to_lang, query, limit=None):
FROM other.simple_translation
WHERE written_rep LIKE :query || '%'
)
ORDER BY max_score * rel_importance DESC
ORDER BY max_score * coalesce(rel_importance, 0.01) DESC
"""
if limit:
sql += ' LIMIT {}'.format(limit)
Expand Down

0 comments on commit 3bd80b5

Please sign in to comment.