fix(search): rebalance scorer to prioritize fuzzy match over frecency - #3749
Open
senamakel wants to merge 1 commit into
Open
fix(search): rebalance scorer to prioritize fuzzy match over frecency#3749senamakel wants to merge 1 commit into
senamakel wants to merge 1 commit into
Conversation
The scorer in the daemon search index added fuzzy_score + frecency with equal weight, allowing frecency (0-200) to dominate the ranking and overriding fuzzy match quality. This caused queries like 'foo bar' to rank 'foo ...b...a...r...' (scattered) above 'foo bar something' (contiguous substring). Fix: make fuzzy_score the primary sort key by multiplying it by 1000, with frecency (capped at 999) as a tiebreaker. This ensures better substring matches consistently rank higher regardless of frecency.
Contributor
Greptile SummaryRebalances daemon search ranking so fuzzy relevance is primary and frecency acts as a bounded tie-breaker.
Confidence Score: 4/5The high-frecency tie-breaking regression should be fixed before merging. Unbounded configuration multipliers can produce frecency values above 999, but the new scorer collapses all of them to one value and lets unrelated fallback ordering decide equally fuzzy results. Files Needing Attention: crates/atuin-daemon/src/search/index.rs Important Files Changed
Reviews (1): Last reviewed commit: "fix(search): rebalance scorer to priorit..." | Re-trigger Greptile |
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.
Summary
Fixes #3702.
The daemon search scorer combined
fuzzy_score + frecencywith equal weight, allowing frecency (typically 0-200) to dominate the ranking and override fuzzy match quality. This caused queries like "foo bar" to rank scattered character matches (e.g., "foo ...b...a...r...") above genuine contiguous substring matches (e.g., "foo bar something"), even though the latter should be clearly better fuzzy matches.As the maintainer noted in the issue, this "could be the search engine over-biasing for frecency over the fuzzy match" and suggested setting
search.frecency_score_multiplier = 0as a workaround.Fix
Changed the scorer in
crates/atuin-daemon/src/search/index.rsto use fuzzy_score as the primary sort key:This ensures fuzzy match quality is the primary ranking criterion, with frecency serving only as a tiebreaker for results with equal fuzzy relevance.
Verification
cargo fmtpassescargo test -p atuin-daemon: 33 tests passed, 0 failedcargo test -p atuin-client: 9 tests passed, 0 failedcargo test -p atuin-nucleo: all tests passedCloses #3702