fix: replace hand-rolled fuzzy search with @nozbe/microfuzz#15
Merged
stackingsaunter merged 1 commit intogetAlby:mainfrom Apr 16, 2026
Merged
Conversation
The previous fuzzy search implementation was too permissive — searching for 'cashu' returned 13+ irrelevant results (Club Orange, CornyChat, Podcast Index, etc.) because the subsequence matching gave non-zero scores to characters scattered across long descriptions. Replace the hand-rolled fuzzyScore/fuzzySubsequence with @nozbe/microfuzz, a tiny zero-dependency library with a 'smart' strategy that filters out poor-quality matches. Also use microfuzz's built-in highlight ranges for more precise search result highlighting. Before: 'cashu' → 13+ results (mostly noise) After: 'cashu' → 3 results (Shopstr, Satsback, Cashu Redeem)
9ebdc57 to
1ebe4b1
Compare
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Searching for
"cashu"returned 13+ irrelevant results (Club Orange, CornyChat, Podcast Index, Podhome, Highlighter, Slice, BTCPay Server, Zeus, Bitcoin Well, Alby PaidMCP…) because the hand-rolledfuzzySubsequence()gave non-zero scores to characters scattered anywhere in the text.Solution
Replace the hand-rolled fuzzy search with
@nozbe/microfuzz— a tiny (zero-dependency) fuzzy search library with a"smart"strategy that filters out poor-quality subsequence matches.Changes
src/lib/discover.ts— RemovefuzzyScore,fuzzySubsequence,scoreAppForQuery,fuzzySearchMatches(~80 lines). AddsearchApps()using microfuzz withstrategy: "smart"and aWeakMapcache for the searcher instance.src/components/app-card.tsx— Replace hand-rolledbestMatchIndex+ single-span highlighting with microfuzzHighlightRangesfor precise multi-range highlighting.src/App.tsx— Compute search results map and passtitleRanges/descriptionRangestoAppCard.Before → After (
"cashu"search)Verification
tsc --noEmitpassesnpm run buildpasses