@@ -191,9 +191,14 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
191
191
if ( incompleteName . StartsWith ( ">" ) )
192
192
{
193
193
searchOption = SearchOption . AllDirectories ;
194
- incompleteName = incompleteName . Substring ( 1 ) ;
194
+
195
+ // match everything before and after search term using supported wildcard '*', ie. *searchterm*
196
+ incompleteName = "*" + incompleteName . Substring ( 1 ) ;
195
197
}
196
-
198
+
199
+ var folderList = new List < Result > ( ) ;
200
+ var fileList = new List < Result > ( ) ;
201
+
197
202
try
198
203
{
199
204
// search folder and add results
@@ -204,11 +209,14 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
204
209
{
205
210
if ( ( fileSystemInfo . Attributes & FileAttributes . Hidden ) == FileAttributes . Hidden ) continue ;
206
211
207
- var result =
208
- fileSystemInfo is DirectoryInfo
209
- ? CreateFolderResult ( fileSystemInfo . Name , fileSystemInfo . FullName , query )
210
- : CreateFileResult ( fileSystemInfo . FullName , query ) ;
211
- results . Add ( result ) ;
212
+ if ( fileSystemInfo is DirectoryInfo )
213
+ {
214
+ folderList . Add ( CreateFolderResult ( fileSystemInfo . Name , fileSystemInfo . FullName , query ) ) ;
215
+ }
216
+ else
217
+ {
218
+ fileList . Add ( CreateFileResult ( fileSystemInfo . FullName , query ) ) ;
219
+ }
212
220
}
213
221
}
214
222
catch ( Exception e )
@@ -223,7 +231,8 @@ fileSystemInfo is DirectoryInfo
223
231
throw ;
224
232
}
225
233
226
- return results ;
234
+ // Intial ordering, this order can be updated later by UpdateResultView.MainViewModel based on history of user selection.
235
+ return results . Concat ( folderList . OrderBy ( x => x . Title ) ) . Concat ( fileList . OrderBy ( x => x . Title ) ) . ToList ( ) ;
227
236
}
228
237
229
238
private static Result CreateFileResult ( string filePath , Query query )
0 commit comments