diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs index b547815e76..d55b42671d 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs @@ -58,7 +58,7 @@ namespace Wox.Plugin.Indexer workingDir = Path.GetDirectoryName(path); Result r = new Result(); - r.Title = Path.GetFileName(path); + r.Title = searchResult.Title; r.SubTitle = path; r.IcoPath = path; r.Action = c => diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/SearchResult.cs b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/SearchResult.cs index fc4c0ed770..d43a0fc701 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/SearchResult.cs +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/SearchResult.cs @@ -10,5 +10,9 @@ namespace Wox.Plugin.Indexer.SearchHelper { // Contains the Path of the file or folder public string Path { get; set; } + + // Contains the Title of the file or folder + public string Title { get; set; } + } } diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs index 857baea11b..6d2b9b1881 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs @@ -34,10 +34,17 @@ namespace Wox.Plugin.Indexer.SearchHelper { if(WDSResults.HasRows) { - while (WDSResults.Read() && WDSResults.GetValue(0) != DBNull.Value) + while (WDSResults.Read()) { - var result = new SearchResult { Path = WDSResults.GetString(0) }; - _Result.Add(result); + if(WDSResults.GetValue(0) != DBNull.Value && WDSResults.GetValue(1) != DBNull.Value) + { + var result = new SearchResult + { + Path = WDSResults.GetString(0), + Title = WDSResults.GetString(1) + }; + _Result.Add(result); + } } } } @@ -88,6 +95,9 @@ namespace Wox.Plugin.Indexer.SearchHelper // Set additional query restriction queryHelper.QueryWhereRestrictions = "AND scope='file:'"; + // To filter based on title for now + queryHelper.QueryContentProperties = "System.Title"; + // Set sorting order queryHelper.QuerySorting = "System.DateModified DESC"; }