@@ -191,9 +191,14 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
191191 if ( incompleteName . StartsWith ( ">" ) )
192192 {
193193 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 ) ;
195197 }
196-
198+
199+ var folderList = new List < Result > ( ) ;
200+ var fileList = new List < Result > ( ) ;
201+
197202 try
198203 {
199204 // search folder and add results
@@ -204,11 +209,14 @@ private List<Result> QueryInternal_Directory_Exists(Query query)
204209 {
205210 if ( ( fileSystemInfo . Attributes & FileAttributes . Hidden ) == FileAttributes . Hidden ) continue ;
206211
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+ }
212220 }
213221 }
214222 catch ( Exception e )
@@ -223,7 +231,8 @@ fileSystemInfo is DirectoryInfo
223231 throw ;
224232 }
225233
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 ( ) ;
227236 }
228237
229238 private static Result CreateFileResult ( string filePath , Query query )
0 commit comments