pass query helper object

This commit is contained in:
Jeremy 2021-07-27 18:55:52 +10:00
parent f588f2a763
commit bd15aa7ef9
2 changed files with 13 additions and 11 deletions

View file

@ -143,7 +143,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
return await IndexSearch.WindowsIndexSearchAsync( return await IndexSearch.WindowsIndexSearchAsync(
querySearchString, querySearchString,
queryConstructor.CreateQueryHelper, queryConstructor.CreateQueryHelper(),
queryConstructor.QueryForFileContentSearch, queryConstructor.QueryForFileContentSearch,
Settings.IndexSearchExcludedSubdirectoryPaths, Settings.IndexSearchExcludedSubdirectoryPaths,
query, query,
@ -181,7 +181,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
return await IndexSearch.WindowsIndexSearchAsync( return await IndexSearch.WindowsIndexSearchAsync(
querySearchString, querySearchString,
queryConstructor.CreateQueryHelper, queryConstructor.CreateQueryHelper(),
queryConstructor.QueryForAllFilesAndFolders, queryConstructor.QueryForAllFilesAndFolders,
Settings.IndexSearchExcludedSubdirectoryPaths, Settings.IndexSearchExcludedSubdirectoryPaths,
query, query,
@ -193,8 +193,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
{ {
var queryConstructor = new QueryConstructor(Settings); var queryConstructor = new QueryConstructor(Settings);
return await IndexSearch.WindowsIndexSearchAsync(path, return await IndexSearch.WindowsIndexSearchAsync(
queryConstructor.CreateQueryHelper, path,
queryConstructor.CreateQueryHelper(),
queryConstructor.QueryForTopLevelDirectorySearch, queryConstructor.QueryForTopLevelDirectorySearch,
Settings.IndexSearchExcludedSubdirectoryPaths, Settings.IndexSearchExcludedSubdirectoryPaths,
query, query,

View file

@ -86,12 +86,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
return results; return results;
} }
internal async static Task<List<Result>> WindowsIndexSearchAsync(string searchString, internal async static Task<List<Result>> WindowsIndexSearchAsync(
Func<CSearchQueryHelper> queryHelper, string searchString,
Func<string, string> constructQuery, CSearchQueryHelper queryHelper,
List<AccessLink> exclusionList, Func<string, string> constructQuery,
Query query, List<AccessLink> exclusionList,
CancellationToken token) Query query,
CancellationToken token)
{ {
var regexMatch = Regex.Match(searchString, reservedStringPattern); var regexMatch = Regex.Match(searchString, reservedStringPattern);
@ -103,7 +104,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
var constructedQuery = constructQuery(searchString); var constructedQuery = constructQuery(searchString);
return RemoveResultsInExclusionList( return RemoveResultsInExclusionList(
await ExecuteWindowsIndexSearchAsync(constructedQuery, queryHelper().ConnectionString, query, token).ConfigureAwait(false), await ExecuteWindowsIndexSearchAsync(constructedQuery, queryHelper.ConnectionString, query, token).ConfigureAwait(false),
exclusionList, exclusionList,
token); token);
} }