Skip to content

Commit 3b05ee2

Browse files
authored
Merge pull request #1899 from Flow-Launcher/everything_full_path_option
add option for everything search in full path (default true)
2 parents e662977 + 73ba236 commit 3b05ee2

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
<system:String x:Key="flowlauncher_plugin_everything_sort_by_descending">&#x2193;</system:String>
128128
<system:String x:Key="flowlauncher_plugin_everything_nonfastsort_warning">Warning: This is not a Fast Sort option, searches may be slow</system:String>
129129

130+
<system:String x:Key="flowlauncher_plugin_everything_search_fullpath">Search Full Path</system:String>
131+
130132
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to launch or install Everything</system:String>
131133
<system:String x:Key="flowlauncher_plugin_everything_installing_title">Everything Installation</system:String>
132134
<system:String x:Key="flowlauncher_plugin_everything_installing_subtitle">Installing Everything service. Please wait...</system:String>

Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,38 @@ private async ValueTask ThrowIfEverythingNotAvailableAsync(CancellationToken tok
4242
private async ValueTask<bool> ClickToInstallEverythingAsync(ActionContext _)
4343
{
4444
var installedPath = await EverythingDownloadHelper.PromptDownloadIfNotInstallAsync(Settings.EverythingInstalledPath, Main.Context.API);
45+
4546
if (installedPath == null)
4647
{
4748
Main.Context.API.ShowMsgError("Unable to find Everything.exe");
49+
4850
return false;
4951
}
52+
5053
Settings.EverythingInstalledPath = installedPath;
5154
Process.Start(installedPath, "-startup");
55+
5256
return true;
5357
}
5458

5559
public async IAsyncEnumerable<SearchResult> SearchAsync(string search, [EnumeratorCancellation] CancellationToken token)
5660
{
5761
await ThrowIfEverythingNotAvailableAsync(token);
62+
5863
if (token.IsCancellationRequested)
5964
yield break;
60-
var option = new EverythingSearchOption(search, Settings.SortOption);
65+
66+
var option = new EverythingSearchOption(search, Settings.SortOption, IsFullPathSearch: Settings.EverythingSearchFullPath);
67+
6168
await foreach (var result in EverythingApi.SearchAsync(option, token))
6269
yield return result;
6370
}
6471
public async IAsyncEnumerable<SearchResult> ContentSearchAsync(string plainSearch,
65-
string contentSearch, [EnumeratorCancellation] CancellationToken token)
72+
string contentSearch,
73+
[EnumeratorCancellation] CancellationToken token)
6674
{
6775
await ThrowIfEverythingNotAvailableAsync(token);
76+
6877
if (!Settings.EnableEverythingContentSearch)
6978
{
7079
throw new EngineNotAvailableException(Enum.GetName(Settings.IndexSearchEngineOption.Everything)!,
@@ -74,16 +83,19 @@ public async IAsyncEnumerable<SearchResult> ContentSearchAsync(string plainSearc
7483
_ =>
7584
{
7685
Settings.EnableEverythingContentSearch = true;
86+
7787
return ValueTask.FromResult(true);
7888
});
7989
}
90+
8091
if (token.IsCancellationRequested)
8192
yield break;
8293

8394
var option = new EverythingSearchOption(plainSearch,
8495
Settings.SortOption,
8596
true,
86-
contentSearch);
97+
contentSearch,
98+
IsFullPathSearch: Settings.EverythingSearchFullPath);
8799

88100
await foreach (var result in EverythingApi.SearchAsync(option, token))
89101
{
@@ -93,13 +105,15 @@ public async IAsyncEnumerable<SearchResult> ContentSearchAsync(string plainSearc
93105
public async IAsyncEnumerable<SearchResult> EnumerateAsync(string path, string search, bool recursive, [EnumeratorCancellation] CancellationToken token)
94106
{
95107
await ThrowIfEverythingNotAvailableAsync(token);
108+
96109
if (token.IsCancellationRequested)
97110
yield break;
98111

99112
var option = new EverythingSearchOption(search,
100113
Settings.SortOption,
101114
ParentPath: path,
102-
IsRecursive: recursive);
115+
IsRecursive: recursive,
116+
IsFullPathSearch: Settings.EverythingSearchFullPath);
103117

104118
await foreach (var result in EverythingApi.SearchAsync(option, token))
105119
{

Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public enum ContentIndexSearchEngineOption
137137
PathEnumerationEngine == PathEnumerationEngineOption.Everything ||
138138
ContentSearchEngine == ContentIndexSearchEngineOption.Everything;
139139

140+
public bool EverythingSearchFullPath { get; set; } = false;
141+
140142
#endregion
141143

142144
internal enum ActionKeyword

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,15 @@
348348
Header="{DynamicResource plugin_explorer_everything_setting_header}"
349349
Style="{DynamicResource ExplorerTabItem}">
350350
<StackPanel Margin="10" Orientation="Vertical">
351+
<StackPanel Orientation="Horizontal">
352+
<TextBlock Margin="10"
353+
VerticalAlignment="Center"
354+
Text="{DynamicResource flowlauncher_plugin_everything_search_fullpath}"/>
355+
<CheckBox Margin="10"
356+
VerticalAlignment="Center"
357+
IsChecked="{Binding Settings.EverythingSearchFullPath}">
358+
</CheckBox>
359+
</StackPanel>
351360
<StackPanel Orientation="Horizontal">
352361
<Grid Margin="20,10,0,10">
353362
<Grid.ColumnDefinitions>

0 commit comments

Comments
 (0)