@@ -14,12 +14,12 @@ public class SearchManager
14
14
{
15
15
internal static PluginInitContext Context ;
16
16
17
- private readonly Settings settings ;
17
+ internal static Settings Settings ;
18
18
19
19
public SearchManager ( Settings settings , PluginInitContext context )
20
20
{
21
21
Context = context ;
22
- this . settings = settings ;
22
+ Settings = settings ;
23
23
}
24
24
25
25
private class PathEqualityComparator : IEqualityComparer < Result >
@@ -71,14 +71,14 @@ private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActio
71
71
72
72
return allowedActionKeyword switch
73
73
{
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 ,
78
78
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
82
82
} ;
83
83
}
84
84
@@ -88,11 +88,11 @@ public async Task<List<Result>> PathSearchAsync(Query query, CancellationToken t
88
88
89
89
// This allows the user to type the assigned action keyword and only see the list of quick folder links
90
90
if ( string . IsNullOrEmpty ( query . Search ) )
91
- return QuickAccess . AccessLinkListAll ( query , settings . QuickAccessLinks ) ;
91
+ return QuickAccess . AccessLinkListAll ( query , Settings . QuickAccessLinks ) ;
92
92
93
93
var results = new HashSet < Result > ( PathEqualityComparator . Instance ) ;
94
94
95
- var quickaccessLinks = QuickAccess . AccessLinkListMatched ( query , settings . QuickAccessLinks ) ;
95
+ var quickaccessLinks = QuickAccess . AccessLinkListMatched ( query , Settings . QuickAccessLinks ) ;
96
96
97
97
results . UnionWith ( quickaccessLinks ) ;
98
98
@@ -136,7 +136,7 @@ public async Task<List<Result>> PathSearchAsync(Query query, CancellationToken t
136
136
private async Task < List < Result > > WindowsIndexFileContentSearchAsync ( Query query , string querySearchString ,
137
137
CancellationToken token )
138
138
{
139
- var queryConstructor = new QueryConstructor ( settings ) ;
139
+ var queryConstructor = new QueryConstructor ( Settings ) ;
140
140
141
141
if ( string . IsNullOrEmpty ( querySearchString ) )
142
142
return new List < Result > ( ) ;
@@ -145,14 +145,14 @@ private async Task<List<Result>> WindowsIndexFileContentSearchAsync(Query query,
145
145
querySearchString ,
146
146
queryConstructor . CreateQueryHelper ,
147
147
queryConstructor . QueryForFileContentSearch ,
148
- settings . IndexSearchExcludedSubdirectoryPaths ,
148
+ Settings . IndexSearchExcludedSubdirectoryPaths ,
149
149
query ,
150
150
token ) . ConfigureAwait ( false ) ;
151
151
}
152
152
153
153
public bool IsFileContentSearch ( string actionKeyword )
154
154
{
155
- return actionKeyword == settings . FileContentSearchActionKeyword ;
155
+ return actionKeyword == Settings . FileContentSearchActionKeyword ;
156
156
}
157
157
158
158
private List < Result > DirectoryInfoClassSearch ( Query query , string querySearch , CancellationToken token )
@@ -177,26 +177,26 @@ public async Task<List<Result>> TopLevelDirectorySearchBehaviourAsync(
177
177
private async Task < List < Result > > WindowsIndexFilesAndFoldersSearchAsync ( Query query , string querySearchString ,
178
178
CancellationToken token )
179
179
{
180
- var queryConstructor = new QueryConstructor ( settings ) ;
180
+ var queryConstructor = new QueryConstructor ( Settings ) ;
181
181
182
182
return await IndexSearch . WindowsIndexSearchAsync (
183
183
querySearchString ,
184
184
queryConstructor . CreateQueryHelper ,
185
185
queryConstructor . QueryForAllFilesAndFolders ,
186
- settings . IndexSearchExcludedSubdirectoryPaths ,
186
+ Settings . IndexSearchExcludedSubdirectoryPaths ,
187
187
query ,
188
188
token ) . ConfigureAwait ( false ) ;
189
189
}
190
190
191
191
private async Task < List < Result > > WindowsIndexTopLevelFolderSearchAsync ( Query query , string path ,
192
192
CancellationToken token )
193
193
{
194
- var queryConstructor = new QueryConstructor ( settings ) ;
194
+ var queryConstructor = new QueryConstructor ( Settings ) ;
195
195
196
196
return await IndexSearch . WindowsIndexSearchAsync ( path ,
197
197
queryConstructor . CreateQueryHelper ,
198
198
queryConstructor . QueryForTopLevelDirectorySearch ,
199
- settings . IndexSearchExcludedSubdirectoryPaths ,
199
+ Settings . IndexSearchExcludedSubdirectoryPaths ,
200
200
query ,
201
201
token ) . ConfigureAwait ( false ) ;
202
202
}
@@ -205,10 +205,10 @@ private bool UseWindowsIndexForDirectorySearch(string locationPath)
205
205
{
206
206
var pathToDirectory = FilesFolders . ReturnPreviousDirectoryIfIncompleteString ( locationPath ) ;
207
207
208
- if ( ! settings . UseWindowsIndexForDirectorySearch )
208
+ if ( ! Settings . UseWindowsIndexForDirectorySearch )
209
209
return false ;
210
210
211
- if ( settings . IndexSearchExcludedSubdirectoryPaths
211
+ if ( Settings . IndexSearchExcludedSubdirectoryPaths
212
212
. Any ( x => FilesFolders . ReturnPreviousDirectoryIfIncompleteString ( pathToDirectory )
213
213
. StartsWith ( x . Path , StringComparison . OrdinalIgnoreCase ) ) )
214
214
return false ;
0 commit comments