Setting search (#41285)

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
Localized search:
<img width="1576" height="480" alt="image"
src="https://github.com/user-attachments/assets/dd6e5e9f-419b-40b1-b796-f0799481ecfc"
/>


## AI summary
This pull request introduces infrastructure and code to support search
functionality for PowerToys settings, including a new search index
specification, a dedicated search library, and updates to the solution
configuration. The main changes are the addition of a spec describing
how settings should be indexed and navigated, the creation of a new
`Common.Search` project with a fuzz search implementation, and updates
to the solution file to include these new components.

**Settings Search Feature Implementation**

* Documentation:
* Added a detailed specification (`settings-search.md`) describing the
structure of PowerToys settings pages, how to index settings, navigation
logic, runtime search, result grouping, build-time indexing strategy,
and corner cases.

* New Search Library:
* Added the new `Common.Search` project to the solution, including its
project file and implementation of a fuzz search service
(`FuzzSearchService<T>`), match options, match results, and search
precision scoring.
[[1]](diffhunk://#diff-ddc06fa41e4e723e54181b0cb85cdd00f57f75725d51ceefa242d4d651a9a363R1-R8)
[[2]](diffhunk://#diff-1a2ca29fc33bcccf338a7843a040ca2c31ba821e8cab7064fab0dbb1224d454cR1-R39)
[[3]](diffhunk://#diff-242764d948b795f39653a84d9b6bfcdc52730100deab2e3a0995be95bb8e7868R1-R10)
[[4]](diffhunk://#diff-61e525491ed916ebd65dabb66dd4f5dc720320d7e295ef1e0bd6d506ea0f7df6R1-R67)
[[5]](diffhunk://#diff-a775f6de2e8d42982829b4161668f49dedbbd9dcbb05ce20003de7e62275c57aR1-R12)

* Solution Configuration:
* Updated `PowerToys.sln` to include `Common.Search` and
`Settings.UI.XamlIndexBuilder` projects, and configured their build
settings for various platforms and mapped project dependencies.
[[1]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R714-R716)
[[2]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2704-R2727)
[[3]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2889)
[[4]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R3157-R3158)

**Spell-check Dictionary Updates**

* Added new terms related to navigation and settings UI components (such
as `Navigatable`, `NavigatablePage`, `settingscard`, `Tru`, `tweakable`)
to the spell-check dictionary to support the new search and indexing
features.
[[1]](diffhunk://#diff-5dcab162c1b233a49973ae010f2b88c7ec4844382abd705e6154685e62bd5c4dR1020-R1021)
[[2]](diffhunk://#diff-5dcab162c1b233a49973ae010f2b88c7ec4844382abd705e6154685e62bd5c4dR1498)
[[3]](diffhunk://#diff-5dcab162c1b233a49973ae010f2b88c7ec4844382abd705e6154685e62bd5c4dR1755-R1761)

---------

Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
Co-authored-by: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com>
This commit is contained in:
Kai Tao
2025-08-25 21:23:07 +08:00
committed by GitHub
parent 64dc8e0f27
commit 4ad951eb56
99 changed files with 3734 additions and 558 deletions

View File

@@ -1,4 +1,4 @@
<Page
<local:NavigatablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
@@ -14,7 +15,7 @@
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<Page.Resources>
<local:NavigatablePage.Resources>
<Style x:Key="OptionSeparator" TargetType="Rectangle">
<Setter Property="Height" Value="1" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
@@ -303,7 +304,7 @@
<DataTemplate x:Key="EmptyTemplate" x:DataType="viewModels:PluginAdditionalOptionViewModel">
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" />
</DataTemplate>
</Page.Resources>
</local:NavigatablePage.Resources>
<controls:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/Run.png">
<controls:SettingsPageControl.ModuleContent>
@@ -322,6 +323,7 @@
</InfoBar.ActionButton>
</InfoBar>
<tkcontrols:SettingsCard
Name="PowerLauncherEnablePowerLauncher"
x:Uid="PowerLauncher_EnablePowerLauncher"
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerToysRun.png}"
IsEnabled="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}">
@@ -340,6 +342,7 @@
<controls:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind ViewModel.EnablePowerLauncher, Mode=OneWay}">
<tkcontrols:SettingsExpander
Name="ActivationShortcut"
x:Uid="Activation_Shortcut"
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}"
IsExpanded="True">
@@ -391,12 +394,16 @@
<controls:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind ViewModel.EnablePowerLauncher, Mode=OneWay}">
<tkcontrols:SettingsExpander
Name="PowerLauncherSearchQueryResultsWithDelay"
x:Uid="PowerLauncher_SearchQueryResultsWithDelay"
HeaderIcon="{ui:FontIcon Glyph=&#xec48;}"
IsExpanded="True">
<ToggleSwitch IsOn="{x:Bind ViewModel.SearchQueryResultsWithDelay, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_FastSearchInputDelayMs" IsEnabled="{x:Bind ViewModel.SearchQueryResultsWithDelay, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="PowerLauncherFastSearchInputDelayMs"
x:Uid="PowerLauncher_FastSearchInputDelayMs"
IsEnabled="{x:Bind ViewModel.SearchQueryResultsWithDelay, Mode=OneWay}">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="50"
@@ -406,7 +413,10 @@
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.SearchInputDelayFast, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_SlowSearchInputDelayMs" IsEnabled="{x:Bind ViewModel.SearchQueryResultsWithDelay, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="PowerLauncherSlowSearchInputDelayMs"
x:Uid="PowerLauncher_SlowSearchInputDelayMs"
IsEnabled="{x:Bind ViewModel.SearchQueryResultsWithDelay, Mode=OneWay}">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="50"
@@ -420,6 +430,7 @@
</tkcontrols:SettingsExpander>
<tkcontrols:SettingsExpander
Name="PowerLauncherMaximumNumberOfResults"
x:Uid="PowerLauncher_MaximumNumberOfResults"
HeaderIcon="{ui:FontIcon Glyph=&#xec8f;}"
IsExpanded="True">
@@ -436,12 +447,16 @@
</tkcontrols:SettingsExpander>
<tkcontrols:SettingsExpander
Name="PowerLauncherSearchQueryTuningEnabled"
x:Uid="PowerLauncher_SearchQueryTuningEnabled"
HeaderIcon="{ui:FontIcon Glyph=&#xE8CB;}"
IsExpanded="True">
<ToggleSwitch IsOn="{x:Bind ViewModel.SearchQueryTuningEnabled, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_SearchClickedItemWeight" IsEnabled="{x:Bind ViewModel.SearchQueryTuningEnabled, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="PowerLauncherSearchClickedItemWeight"
x:Uid="PowerLauncher_SearchClickedItemWeight"
IsEnabled="{x:Bind ViewModel.SearchQueryTuningEnabled, Mode=OneWay}">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="50"
@@ -457,15 +472,24 @@
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_TabSelectsContextButtons" HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}">
<tkcontrols:SettingsCard
Name="PowerLauncherTabSelectsContextButtons"
x:Uid="PowerLauncher_TabSelectsContextButtons"
HeaderIcon="{ui:FontIcon Glyph=&#xE7FD;}">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_UsePinyin" HeaderIcon="{ui:FontIcon Glyph=&#xE98A;}">
<tkcontrols:SettingsCard
Name="PowerLauncherUsePinyin"
x:Uid="PowerLauncher_UsePinyin"
HeaderIcon="{ui:FontIcon Glyph=&#xE98A;}">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles" HeaderIcon="{ui:FontIcon Glyph=&#xE91B;}">
<tkcontrols:SettingsCard
Name="PowerLauncherGenerateThumbnailsFromFiles"
x:Uid="PowerLauncher_GenerateThumbnailsFromFiles"
HeaderIcon="{ui:FontIcon Glyph=&#xE91B;}">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</controls:SettingsGroup>
@@ -491,7 +515,10 @@
/>-->
<controls:SettingsGroup x:Uid="Run_PositionAppearance_GroupSettings" IsEnabled="{x:Bind ViewModel.EnablePowerLauncher, Mode=OneWay}">
<tkcontrols:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}">
<tkcontrols:SettingsCard
Name="RunPositionHeader"
x:Uid="Run_PositionHeader"
HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.MonitorPositionIndex, Mode=TwoWay}">
<ComboBoxItem x:Uid="Run_Radio_Position_Cursor" />
<ComboBoxItem x:Uid="Run_Radio_Position_Primary_Monitor" />
@@ -499,7 +526,10 @@
</ComboBox>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}">
<tkcontrols:SettingsCard
Name="ColorModeHeader"
x:Uid="ColorModeHeader"
HeaderIcon="{ui:FontIcon Glyph=&#xE790;}">
<tkcontrols:SettingsCard.Description>
<HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" />
</tkcontrols:SettingsCard.Description>
@@ -510,7 +540,10 @@
</ComboBox>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_ShowPluginKeywords" HeaderIcon="{ui:FontIcon Glyph=&#xE8FD;}">
<tkcontrols:SettingsCard
Name="PowerLauncherShowPluginKeywords"
x:Uid="PowerLauncher_ShowPluginKeywords"
HeaderIcon="{ui:FontIcon Glyph=&#xE8FD;}">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.ShowPluginsOverviewIndex, Mode=TwoWay}">
<ComboBoxItem x:Uid="ShowPluginsOverview_All" />
<ComboBoxItem x:Uid="ShowPluginsOverview_NonGlobal" />
@@ -518,7 +551,10 @@
</ComboBox>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_TitleFontSize" HeaderIcon="{ui:FontIcon Glyph=&#xE8E9;}">
<tkcontrols:SettingsCard
Name="PowerLauncherTitleFontSize"
x:Uid="PowerLauncher_TitleFontSize"
HeaderIcon="{ui:FontIcon Glyph=&#xE8E9;}">
<StackPanel Orientation="Horizontal" Spacing="12">
<TextBlock
VerticalAlignment="Center"
@@ -559,7 +595,10 @@
</InfoBar.ActionButton>
</InfoBar>
<tkcontrols:SettingsCard x:Uid="Run_PluginUse" HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}">
<tkcontrols:SettingsCard
Name="RunPluginUse"
x:Uid="Run_PluginUse"
HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}">
<tkcontrols:SettingsCard.Description>
<StackPanel>
<TextBlock x:Uid="Run_PluginUseDescription" />
@@ -649,7 +688,10 @@
</StackPanel>
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_ActionKeyword" IsEnabled="{x:Bind Enabled, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="PowerLauncherActionKeyword"
x:Uid="PowerLauncher_ActionKeyword"
IsEnabled="{x:Bind Enabled, Mode=OneWay}">
<TextBox MinWidth="{StaticResource SettingActionControlMinWidth}" Text="{x:Bind ActionKeyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard
@@ -682,7 +724,10 @@
</StackPanel>
</CheckBox>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="PowerLauncher_PluginWeightBoost" IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="PowerLauncherPluginWeightBoost"
x:Uid="PowerLauncher_PluginWeightBoost"
IsEnabled="{x:Bind IsGlobalAndEnabled, Mode=OneWay}">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="50"
@@ -771,4 +816,4 @@
<controls:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</Page>
</local:NavigatablePage>