[AI] Improve autocomplete sorting with tiered ranking#6972
[AI] Improve autocomplete sorting with tiered ranking#6972matt-fidd merged 2 commits intoactualbudget:masterfrom
Conversation
Replace binary match/no-match sorting in payee and category dropdowns with a 4-tier ranking: exact match, prefix match, word-boundary match, and substring match. This surfaces the most relevant results first (e.g. typing "me" shows "Me" before "Memory Express" before "Framework"). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hello contributor! We would love to review your PR! Before we can do that, please make sure:
We do this to reduce the TOIL the core contributor team has to go through for each PR and to allow for speedy reviews and merges. For more information, please see our Contributing Guide. |
📝 WalkthroughWalkthroughThis PR introduces a new ranking function for autocomplete matching and integrates it into category and payee autocomplete components. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
matt-fidd
left a comment
There was a problem hiding this comment.
Brilliant! Thanks for this, it's much more granular and seems to make searching in my budget file better
|
Happy to see this merged. Thanks for the positive comments Matt. |
) Replace binary match/no-match sorting in payee and category dropdowns with a 4-tier ranking: exact match, prefix match, word-boundary match, and substring match. This surfaces the most relevant results first (e.g. typing "me" shows "Me" before "Memory Express" before "Framework"). Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Changes
autocompleteRanking.tsrankAutocompleteMatch(name, input)function that returns a tiered rank:getNormalisedStringfor case/diacritic-insensitive comparison. Word boundaries are split on whitespace and hyphens.PayeeAutocomplete.tsxcustomSortnow delegates torankAutocompleteMatchinstead of a simpleincludescheck.CategoryAutocomplete.tsxcustomSortnow uses tiered ranking for category names, with group name matching as afallback tier between name matches and no-match.
autocompleteRanking.test.tsTest plan
rankAutocompleteMatch(11 tests covering all tiers, diacritics, case insensitivity, edge cases)yarn typecheckpassesyarn lintpassesBundle Stats
View detailed bundle stats
desktop-client
Total
Changeset
src/components/autocomplete/autocompleteRanking.tssrc/components/autocomplete/CategoryAutocomplete.tsxsrc/components/autocomplete/PayeeAutocomplete.tsxView detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
Smaller
No assets were smaller
Unchanged
loot-core
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
api
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged