@@ -12,14 +12,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search
1212{
1313 public class SearchManager
1414 {
15- private readonly PluginInitContext context ;
15+ internal static PluginInitContext Context ;
1616
17- private readonly Settings settings ;
17+ internal static Settings Settings ;
1818
1919 public SearchManager ( Settings settings , PluginInitContext context )
2020 {
21- this . context = context ;
22- this . settings = settings ;
21+ Context = context ;
22+ Settings = settings ;
2323 }
2424
2525 private class PathEqualityComparator : IEqualityComparer < Result >
@@ -71,14 +71,14 @@ private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActio
7171
7272 return allowedActionKeyword switch
7373 {
74- Settings . ActionKeyword . SearchActionKeyword => settings . SearchActionKeywordEnabled &&
75- keyword == settings . SearchActionKeyword ,
76- Settings . ActionKeyword . PathSearchActionKeyword => settings . PathSearchKeywordEnabled &&
77- keyword == settings . PathSearchActionKeyword ,
74+ Settings . ActionKeyword . SearchActionKeyword => Settings . SearchActionKeywordEnabled &&
75+ keyword == Settings . SearchActionKeyword ,
76+ Settings . ActionKeyword . PathSearchActionKeyword => Settings . PathSearchKeywordEnabled &&
77+ keyword == Settings . PathSearchActionKeyword ,
7878 Settings . ActionKeyword . FileContentSearchActionKeyword => keyword ==
79- settings . FileContentSearchActionKeyword ,
80- Settings . ActionKeyword . IndexSearchActionKeyword => settings . IndexOnlySearchKeywordEnabled &&
81- keyword == settings . IndexSearchActionKeyword
79+ Settings . FileContentSearchActionKeyword ,
80+ Settings . ActionKeyword . IndexSearchActionKeyword => Settings . IndexOnlySearchKeywordEnabled &&
81+ keyword == Settings . IndexSearchActionKeyword
8282 } ;
8383 }
8484
@@ -88,18 +88,18 @@ public async Task<List<Result>> PathSearchAsync(Query query, CancellationToken t
8888
8989 // This allows the user to type the assigned action keyword and only see the list of quick folder links
9090 if ( string . IsNullOrEmpty ( query . Search ) )
91- return QuickAccess . AccessLinkListAll ( query , settings . QuickAccessLinks ) ;
91+ return QuickAccess . AccessLinkListAll ( query , Settings . QuickAccessLinks ) ;
9292
9393 var results = new HashSet < Result > ( PathEqualityComparator . Instance ) ;
9494
95- var quickaccessLinks = QuickAccess . AccessLinkListMatched ( query , settings . QuickAccessLinks ) ;
95+ var quickaccessLinks = QuickAccess . AccessLinkListMatched ( query , Settings . QuickAccessLinks ) ;
9696
9797 results . UnionWith ( quickaccessLinks ) ;
9898
9999 var isEnvironmentVariable = EnvironmentVariables . IsEnvironmentVariableSearch ( querySearch ) ;
100100
101101 if ( isEnvironmentVariable )
102- return EnvironmentVariables . GetEnvironmentStringPathSuggestions ( querySearch , query , context ) ;
102+ return EnvironmentVariables . GetEnvironmentStringPathSuggestions ( querySearch , query , Context ) ;
103103
104104 // Query is a location path with a full environment variable, eg. %appdata%\somefolder\
105105 var isEnvironmentVariablePath = querySearch [ 1 ..] . Contains ( "%\\ " ) ;
@@ -136,22 +136,23 @@ public async Task<List<Result>> PathSearchAsync(Query query, CancellationToken t
136136 private async Task < List < Result > > WindowsIndexFileContentSearchAsync ( Query query , string querySearchString ,
137137 CancellationToken token )
138138 {
139- var queryConstructor = new QueryConstructor ( settings ) ;
139+ var queryConstructor = new QueryConstructor ( Settings ) ;
140140
141141 if ( string . IsNullOrEmpty ( querySearchString ) )
142142 return new List < Result > ( ) ;
143143
144- return await IndexSearch . WindowsIndexSearchAsync ( querySearchString ,
145- queryConstructor . CreateQueryHelper ( ) . ConnectionString ,
144+ return await IndexSearch . WindowsIndexSearchAsync (
145+ querySearchString ,
146+ queryConstructor . CreateQueryHelper ( ) ,
146147 queryConstructor . QueryForFileContentSearch ,
147- settings . IndexSearchExcludedSubdirectoryPaths ,
148+ Settings . IndexSearchExcludedSubdirectoryPaths ,
148149 query ,
149150 token ) . ConfigureAwait ( false ) ;
150151 }
151152
152153 public bool IsFileContentSearch ( string actionKeyword )
153154 {
154- return actionKeyword == settings . FileContentSearchActionKeyword ;
155+ return actionKeyword == Settings . FileContentSearchActionKeyword ;
155156 }
156157
157158 private List < Result > DirectoryInfoClassSearch ( Query query , string querySearch , CancellationToken token )
@@ -176,25 +177,27 @@ public async Task<List<Result>> TopLevelDirectorySearchBehaviourAsync(
176177 private async Task < List < Result > > WindowsIndexFilesAndFoldersSearchAsync ( Query query , string querySearchString ,
177178 CancellationToken token )
178179 {
179- var queryConstructor = new QueryConstructor ( settings ) ;
180+ var queryConstructor = new QueryConstructor ( Settings ) ;
180181
181- return await IndexSearch . WindowsIndexSearchAsync ( querySearchString ,
182- queryConstructor . CreateQueryHelper ( ) . ConnectionString ,
182+ return await IndexSearch . WindowsIndexSearchAsync (
183+ querySearchString ,
184+ queryConstructor . CreateQueryHelper ( ) ,
183185 queryConstructor . QueryForAllFilesAndFolders ,
184- settings . IndexSearchExcludedSubdirectoryPaths ,
186+ Settings . IndexSearchExcludedSubdirectoryPaths ,
185187 query ,
186188 token ) . ConfigureAwait ( false ) ;
187189 }
188190
189191 private async Task < List < Result > > WindowsIndexTopLevelFolderSearchAsync ( Query query , string path ,
190192 CancellationToken token )
191193 {
192- var queryConstructor = new QueryConstructor ( settings ) ;
194+ var queryConstructor = new QueryConstructor ( Settings ) ;
193195
194- return await IndexSearch . WindowsIndexSearchAsync ( path ,
195- queryConstructor . CreateQueryHelper ( ) . ConnectionString ,
196+ return await IndexSearch . WindowsIndexSearchAsync (
197+ path ,
198+ queryConstructor . CreateQueryHelper ( ) ,
196199 queryConstructor . QueryForTopLevelDirectorySearch ,
197- settings . IndexSearchExcludedSubdirectoryPaths ,
200+ Settings . IndexSearchExcludedSubdirectoryPaths ,
198201 query ,
199202 token ) . ConfigureAwait ( false ) ;
200203 }
@@ -203,10 +206,10 @@ private bool UseWindowsIndexForDirectorySearch(string locationPath)
203206 {
204207 var pathToDirectory = FilesFolders . ReturnPreviousDirectoryIfIncompleteString ( locationPath ) ;
205208
206- if ( ! settings . UseWindowsIndexForDirectorySearch )
209+ if ( ! Settings . UseWindowsIndexForDirectorySearch )
207210 return false ;
208211
209- if ( settings . IndexSearchExcludedSubdirectoryPaths
212+ if ( Settings . IndexSearchExcludedSubdirectoryPaths
210213 . Any ( x => FilesFolders . ReturnPreviousDirectoryIfIncompleteString ( pathToDirectory )
211214 . StartsWith ( x . Path , StringComparison . OrdinalIgnoreCase ) ) )
212215 return false ;
0 commit comments