microsoft / microsoft/winget-cli
Standardize package query behavior
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
Making this as a feature request instead of a bug report as I'm almost certain that the behavior here is, or was, at one point, intentional. Therefore, I'm requesting that the use cases around the package matching logic be re-evaluated to see if they still make sense with the current roadmap
When winget search returns a single package, I would expect that the query used is disambiguous. Therefore, when a single package is returned from search, the same query should return a single package for winget show . This is not the case.
When running with verbose logs I see that this is the query that winget search runs - WinGet-Search-2022-03-30-07-45-12.609.log
2022-03-30 07:45:14.180 [REPO] Performing search: Query:'windowspchealthcheck'[Substring]
and this is the query winget show runs - WinGet-Show-2022-03-30-07-45-20.310.log
2022-03-30 07:45:20.440 [REPO] Performing search: Query:[none] Include:PackageFamilyName='windowspchealthcheck'[Exact] Include:ProductCode='windowspchealthcheck'[Exact] Include:Id='windowspchealthcheck'[CaseInsensitive] Include:Name='windowspchealthcheck'[CaseInsensitive] Include:Moniker='windowspchealthcheck'[CaseInsensitive]
Note: msstore source has been dropped with
winget source remove msstore
PS C:\WINDOWS\system32> winget search windowspchealthcheck
Name Id Version
---------------------------------------------------------------------
Windows PC Health Check Microsoft.WindowsPCHealthCheck 3.3.2110.22002
PS C:\WINDOWS\system32> winget show windowspchealthcheck --versions
No package found matching input criteria.
PS C:\WINDOWS\system32> winget --info |sls 'Windows Package Manager'
Windows Package Manager (Preview) v1.3.431-preview
Proposed technical implementation details
Perhaps if the more restrictive query used for show returns no results, then it can fall back to the substring query used by search? If the less restrictive query returns more than one result, then it can be handled the same way as if multiple packages are found for other commands.
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 by reproducing the winget search windowspchealthcheck and winget show windowspchealthcheck --versions commands, then compare their verbose log queries. Trace the search and show matching paths to determine whether a fallback is appropriate when the restrictive query finds nothing. Done means an unambiguous search result can be shown while multiple fallback matches retain the existing ambiguity handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100