Fix Settings search dropping settings that contain the query substring#310898
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix Settings search dropping settings that contain the query substring#310898yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When a search query like "instructionfiles" is a literal substring of one setting ID (e.g. copilot.chat.codeGeneration.useInstructionFiles), that match scores ContiguousQueryInSettingId. Other settings whose IDs also contain the substring but only fuzzy-match (e.g. chat.instructionsFilesLocations, broken by the plural) score lower and were dropped by the top-match-type filter, even though they clearly should appear. When any result matches via ContiguousQueryInSettingId, widen the allowed key-match bitmask to include all SettingKeyMatchTypes. The original "top match type" filter is preserved for purely fuzzy queries, where it protects against noisy results. Fixes microsoft#247715
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @rzhao271Matched files:
|
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
When a search query is a literal substring of one setting's ID, related settings whose IDs also contain the substring but only fuzzy-match (e.g. differing by a plural "s") were dropped from results.
Example from #247715: typing `instructionfiles` showed `github.copilot.chat.codeGeneration.useInstructionFiles` but not `chat.instructionsFilesLocations` — both settings clearly contain the query substring, but the second only matched as a non-contiguous query because of the plural.
Root cause
`preferencesSearch.ts` computes `topKeyMatchType` from the best key-match score across all results, then filters out any match that doesn't include that exact bit. When one result scores `ContiguousQueryInSettingId` (1<<6) and another only scores `NonContiguousQueryInSettingId` (1<<2), the latter is dropped.
Fix
When any result has a contiguous substring match on a setting ID, the query is specific enough that we keep all key-level matches rather than dropping lower-tier ones. The original "top match type" filter is preserved for purely fuzzy queries where it still protects against noisy results.
Quoting @joaomoreno from the issue:
Test plan
Fixes #247715