Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fuzzy search based on Levenshtein distance #645

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

christoph-heinrich
Copy link
Contributor

@christoph-heinrich christoph-heinrich commented Sep 23, 2023

I don't know if that will ever go anywhere, but it's easier to test this way and it's a dedicated place to discuss this.

Ref. #625 (comment)

Depends on #644, but doesn't add text and hint characters together.

@tomasklaen
Copy link
Owner

I find it more confusing then helpful. For example, trying to match word upscale while leaving out letter p produces:

u - matches
us - nothing (I'd give up here and rewrite/fix my query)
usc - matches again

I'm really fine with what we have + #644. Implementing fulltext search features for a dumb single level list of short phrases is waay too much. I'd prefer a simple search implementation with slimmer menu.lua file over having this in. Please don't waste your time working on this :)

@christoph-heinrich
Copy link
Contributor Author

It's less confusing without the cutoff.

@christoph-heinrich
Copy link
Contributor Author

christoph-heinrich commented Sep 26, 2023

I like wasting my time 🙃

As it turns out Levenshtein is much slower then Hamming, and the query length makes a huge difference.
Reusing the matrix table gave a 4x performance improvement, and pulling out everything that can be prepared ahead of time gave another 2x improvement.
It should be fine for anything but extreme use-cases and I'd expect the query to typically be fairly short anyway.

That's probably as good as a fuzzy search gets.

Selecting the top search result allows one to immediatelly activating an
item after typing without having to navigate to it.
@christoph-heinrich christoph-heinrich changed the title feat: fuzzy search based on hamming distance feat: fuzzy search based on Levenshtein distance Sep 30, 2023
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.

None yet

2 participants