Skip to content

Conversation

@deltazefiro
Copy link
Contributor

Enhanced the fuzzy search.

  1. Integrate FuzzyWuzzy. Replace the naive implementation with FuzzyWuzzy that utilizes the Levenshtein distance algorithm. This will allow the search to intelligently handle a certain number of character substitutions, insertions, or deletions, making it tolerant of common typos.

  2. Sanitize the Search Query. Before performing the search, pre-process the input query to remove all spaces and single quote marks. This step will ensure that IME-generated artifacts do not interfere with search results.

Issue: closes #3


Tested on op13 with launcher v15.8.17. Works pretty fine with no noticeable performance issue.
I'm kinda vibe coding this so may need some more time to test it out. Marked as draft for now.

@deltazefiro deltazefiro marked this pull request as draft August 10, 2025 13:42
@wizpizz
Copy link
Owner

wizpizz commented Aug 10, 2025

Thanks for the PR. I just compiled the app to check out the algo for myself and was kinda caught off guard with the search results

For example, here, I would expect the both apps with the title "Fotos" to appear as the first results since the word begins with the searched query "Fo".
image

Or here, YouTube is the only app in the results that contain the letters 'y', 't' and 'b'. Yet it's the last search result for some reason.
image

I assume this is because the algorithm does not really weigh finding prefixes more or if query chars appear subsequently in the same order in the app name (ytb -> youtube). Lemme know if this can be inherently fixed via the library itself that you used by changing parameters or if you'd be open to manually changing calculateMatchScore() so that we artificially boost the score certain criteria are met (matching prefix, subsequent chars...) But I hope you understand why this bothers me since it kinda invalidates the purpose of being able to quickly launch the first search result by pressing the Enter key haha

@deltazefiro
Copy link
Contributor Author

deltazefiro commented Aug 11, 2025

Oh I see.

the algorithm does not really weigh finding prefixes more or if query chars appear subsequently in the same order

Indeed! The Levenshtein distance does not take those into consideration. It only counts "edits" between strings.

if you'd be open to manually changing calculateMatchScore() so that we artificially boost the score

I've updated the code to boost:

  • prefixes by 1.5
  • substrings by 1.2
  • subsequences by 1.1

I do not have many apps installed so the results both before and after the boost seem reasonably fine.
Please let me know how it works on your end!

@deltazefiro deltazefiro marked this pull request as ready for review August 11, 2025 10:43
@wizpizz
Copy link
Owner

wizpizz commented Aug 11, 2025

LGTM, thanks!

@wizpizz wizpizz merged commit 92e80de into wizpizz:master Aug 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FeatureRequest] Better fuzzy search

2 participants