From 2643c7d7302d76b0d8737b29d0b456ca7f24cb2b Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 19 Jan 2021 07:05:30 +1100 Subject: [PATCH 1/4] exclude index search on special chars --- .../Search/WindowsIndex/IndexSearch.cs | 4 ++-- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs index 5b1d47ef8..06059ceea 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Infrastructure.Logger; +using Flow.Launcher.Infrastructure.Logger; using Microsoft.Search.Interop; using System; using System.Collections.Generic; @@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex private readonly ResultManager resultManager; // Reserved keywords in oleDB - private readonly string reservedStringPattern = @"^[\/\\\$\%_]+$"; + private readonly string reservedStringPattern = @"^[`\@\#\^,\&\/\\\$\%_]+$"; internal IndexSearch(PluginInitContext context) { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index e62ea93fc..e62637896 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -1,7 +1,6 @@ using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Flow.Launcher.Plugin.Explorer { From ed1bf0e956fe2b713d2715252a6636a98ecc857e Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 19 Jan 2021 07:07:06 +1100 Subject: [PATCH 2/4] version bump Explorer plugin --- Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index aa44c4413..49baa5090 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -7,7 +7,7 @@ "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.2.6", + "Version": "1.2.7", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", From 3e6961dc9f8de23730a5ed852fe3492f5af7d587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Sat, 23 Jan 2021 12:33:47 +0800 Subject: [PATCH 3/4] automatically check whether we shall reindex when querying --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index d7413874b..e2a6f929d 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -41,6 +41,9 @@ namespace Flow.Launcher.Plugin.Program public async Task> QueryAsync(Query query, CancellationToken token) { + if (IsStartupIndexProgramsRequired) + _ = IndexPrograms(); + Win32[] win32; UWP.Application[] uwps; From 267c796ad8d7ff9fa98cbaf2855ae42b7d62424d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Sat, 23 Jan 2021 12:40:10 +0800 Subject: [PATCH 4/4] await indexing process in Program plugin --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 2 +- .../Views/ProgramSetting.xaml.cs | 26 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index e2a6f929d..22f4aea59 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -150,7 +150,7 @@ namespace Flow.Launcher.Plugin.Program var t2 = Task.Run(IndexUwpPrograms); - await Task.WhenAll(t1, t2); + await Task.WhenAll(t1, t2).ConfigureAwait(false); _settings.LastIndexTime = DateTime.Today; } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs index e4e92b9bc..d66ca345e 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs @@ -51,7 +51,7 @@ namespace Flow.Launcher.Plugin.Program.Views private void ViewRefresh() { - if(programSourceView.Items.Count == 0 + if (programSourceView.Items.Count == 0 && btnProgramSourceStatus.Visibility == Visibility.Visible && btnEditProgramSource.Visibility == Visibility.Visible) { @@ -70,21 +70,19 @@ namespace Flow.Launcher.Plugin.Program.Views programSourceView.Items.Refresh(); } - private void ReIndexing() + private async void ReIndexing() { ViewRefresh(); - Task.Run(() => - { - Dispatcher.Invoke(() => { indexingPanel.Visibility = Visibility.Visible; }); - Main.IndexPrograms(); - Dispatcher.Invoke(() => { indexingPanel.Visibility = Visibility.Hidden; }); - }); + + indexingPanel.Visibility = Visibility.Visible; + await Main.IndexPrograms(); + indexingPanel.Visibility = Visibility.Hidden; } private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e) { var add = new AddProgramSource(context, _settings); - if(add.ShowDialog() ?? false) + if (add.ShowDialog() ?? false) { ReIndexing(); } @@ -165,14 +163,14 @@ namespace Flow.Launcher.Plugin.Program.Views UniqueIdentifier = directory }; - directoriesToAdd.Add(source); + directoriesToAdd.Add(source); } } if (directoriesToAdd.Count() > 0) { directoriesToAdd.ForEach(x => _settings.ProgramSources.Add(x)); - directoriesToAdd.ForEach(x => ProgramSettingDisplayList.Add(x)); + directoriesToAdd.ForEach(x => ProgramSettingDisplayList.Add(x)); ViewRefresh(); ReIndexing(); @@ -238,8 +236,8 @@ namespace Flow.Launcher.Plugin.Program.Views ProgramSettingDisplayList.SetProgramSourcesStatus(selectedItems, true); ProgramSettingDisplayList.RemoveDisabledFromSettings(); - } - + } + if (selectedItems.IsReindexRequired()) ReIndexing(); @@ -282,7 +280,7 @@ namespace Flow.Launcher.Plugin.Program.Views var sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string; Sort(sortBy, direction); - + _lastHeaderClicked = headerClicked; _lastDirection = direction; }