feat(sorting): add sorting strategy selector (fuzzy, frecency, disabled) #756
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.
📺 PR Description
Summary
Adds a new sorting strategy selector that gives users control over how results are ordered. Three strategies are now available:
Motivation
Different use cases benefit from different sorting approaches. While fuzzy matching works well for exploring results, some channels like shell history benefit from preserving chronological order. The new frecency strategy learns from user behavior to surface the most relevant results based on frequency and recency of selection.
Key Features
--sorting-strategy <STRATEGY>to override sorting behaviorUsage Examples
The sorting strategy can be configured globally in
config.toml:Or per-channel in cable channel definitions:
Implementation Notes
This feature leverages a custom fork of the nucleo fuzzy matcher that adds frecency support. The frecency algorithm tracks both frequency (how often items are selected) and recency
(when they were last used) to prioritize results.
Why Vendoring
Why frecency is a better match inside nucleo
Checklist
This PR resolves #671 and resolves #672
Edit: Added why vendoring rationale as opposed to #671