From 690d60b7011135f40c852ad2aa0d335e66abf7a8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 19 May 2020 22:38:42 +1000 Subject: [PATCH] Add the use of a SearchManager --- Plugins/Flow.Launcher.Plugin.Explorer/Main.cs | 12 ++---------- .../Search/SearchManager.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs index 1740e0e5b..80f872cf6 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs @@ -1,10 +1,8 @@ using Flow.Launcher.Infrastructure.Storage; -using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex; +using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.ViewModels; using Flow.Launcher.Plugin.Explorer.Views; -using System; using System.Collections.Generic; -using System.Text; using System.Text.RegularExpressions; using System.Windows.Controls; @@ -51,13 +49,7 @@ namespace Flow.Launcher.Plugin.Explorer if (regexMatch.Success) return results; - var queryConstructor = new QueryConstructor(_settings); - - var searcher = new IndexSearcher(Context); - - return searcher.WindowsIndexSearch(query.Search, - queryConstructor.CreateQueryHelper().ConnectionString, - queryConstructor.QueryForAllFilesAndFolders); + return new SearchManager(_settings, Context).Search(query.Search); } public void Save() diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 1dd834428..80a764d50 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -61,5 +61,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search return results; } + + internal List WindowsIndexFilesAndFoldersSearch(string querySearchString) + { + var queryConstructor = new QueryConstructor(_settings); + + var searcher = new IndexSearcher(_context); + + return searcher.WindowsIndexSearch(querySearchString, + queryConstructor.CreateQueryHelper().ConnectionString, + queryConstructor.QueryForAllFilesAndFolders); + } } }