SerenityOS / serenity

The Serenity Operating System 🐞
https://serenityos.org
BSD 2-Clause "Simplified" License
30.47k stars 3.18k forks source link

LibGUI: Rank emoji search results based on query scores #24644

Open ebanner opened 3 months ago

ebanner commented 3 months ago

This PR aims to improve emoji search in the emoji input dialog.

When I type fire I'd ideally like for the fire emoji 🔥 to be the first one that comes up.

Before

image

As you can see the fire emoji 🔥 is way down on the list. That is because the current logic doesn't do any re-ranking based on the query - it just filters away emojis which don't match the query (keeps the original ordering).

After

image

Now the fire emoji 🔥 ranks highly up on the list because we re-rank by the fuzzy scores.

Notes

Unfortunately fire 🔥 is not the first emoji that comes up. This is because of the scores that fuzzy_match() is returning:

Fire Engine, 🚒 Score: 168
Flag: Ireland, 🇮🇪 Score: 166
Fire, 🔥 Score: 160

I basically consider this a bug in AK/FuzzyMatch.cpp and I think it's worth opening an issue for it. I expect that fire should get the highest score.

EDIT: Looks like this issue has been fixed!

BuggieBot commented 3 months ago

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why. Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

stale[bot] commented 2 months ago

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

LucasChollet commented 1 month ago

Seems alright, we don't squash commits on merge tho, please fixup your second commit into the first one.

stale[bot] commented 1 month ago

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

ebanner commented 1 month ago

done 👍