microsoft / microsoft/winget-cli
Enhance search algorithm
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Description of the new feature/enhancement
When I make a typo and no matches are found with winget search. It would be nice if additional logic might be able to make suggestions.
https://github.com/microsoft/winget-pkgs/pull/14773
Proposed technical implementation details (optional)
The building blocks already exist: the SQLite index supports MatchType::Fuzzy and MatchType::FuzzySubstring (fuzzy is used today for installed-package correlation, not for user search). The default winget search uses MatchType::Substring, so a typo simply returns zero results with no fallback.
Suggested bounded MVP (start here):
- Scope to the
searchcommand and the local/SQLite source only. - When the initial query returns zero matches, re-issue the same query with
MatchType::FuzzySubstringand, if candidates come back, present them as suggestions (e.g., "No package found matching ''. Did you mean:") followed by the candidate list. - Gate the behavior behind a setting (with a sensible default), consistent with how we pair new behaviors with a setting to prefer/require/disable them.
Out of scope for the MVP / follow-up work:
- REST and composite sources -
searchaggregates across sources and the REST search serializer forwards match types; not every REST source implements fuzzy matching, so the fallback must degrade gracefully per source rather than error. Handle local-source first, then extend. - Suggestion quality/ranking - the current fuzzy match is n-gram/moniker-based rather than a classic edit-distance "did you mean," so relevance thresholds and ranking will need tuning to avoid noisy suggestions. This is the main risk and likely the bulk of the effort.
- Other commands - the same zero-result path exists for
install/upgrade/show(single-query). Whether to surface suggestions there too is a follow-up decision once thesearchUX is proven.
The local-source search-only slice is small and self-contained; the cross-source behavior and suggestion ranking are the parts that carry the real complexity.
(Updated with GitHub Copilot assistance.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the search command's zero-result path and inspect the local SQLite source, then compare existing uses of MatchType::Fuzzy and MatchType::FuzzySubstring with the project's patterns for settings. Done means the local-source search can optionally show bounded fuzzy suggestions after zero substring matches, with tests covering the setting and suggestion output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sqlite
- Domain
- cli, databases, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100