Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ private static List<Result> DirectorySearch(EnumerationOptions enumerationOption
if (fileSystemInfo is System.IO.DirectoryInfo)
{
folderList.Add(ResultManager.CreateFolderResult(fileSystemInfo.Name, fileSystemInfo.FullName,
fileSystemInfo.FullName, query, true, false));
fileSystemInfo.FullName, query, 0, true, false));
}
else
{
fileList.Add(ResultManager.CreateFileResult(fileSystemInfo.FullName, query, true, false));
fileList.Add(ResultManager.CreateFileResult(fileSystemInfo.FullName, query, 0, true, false));
}

token.ThrowIfCancellationRequested();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ internal static List<Result> AccessLinkListMatched(Query query, List<AccessLink>

var queriedAccessLinks =
accessLinks
.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase))
.Where(x => x.Nickname.Contains(search, StringComparison.OrdinalIgnoreCase))
.OrderBy(x => x.Type)
.ThenBy(x => x.Nickname);

return queriedAccessLinks.Select(l => l.Type switch
{
ResultType.Folder => ResultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query),
ResultType.File => ResultManager.CreateFileResult(l.Path, query),
ResultType.Folder => ResultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query, 100),
ResultType.File => ResultManager.CreateFileResult(l.Path, query, 100),
_ => throw new ArgumentOutOfRangeException()

}).ToList();
Expand All @@ -35,7 +35,7 @@ internal static List<Result> AccessLinkListAll(Query query, List<AccessLink> acc
.Select(l => l.Type switch
{
ResultType.Folder => ResultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query),
ResultType.File => ResultManager.CreateFileResult(l.Path, query),
ResultType.File => ResultManager.CreateFileResult(l.Path, query, 100),
_ => throw new ArgumentOutOfRangeException()

}).ToList();
Expand Down
10 changes: 6 additions & 4 deletions Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void Init(PluginInitContext context)
Context = context;
}

internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, bool showIndexState = false, bool windowsIndexed = false)
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
{
return new Result
{
Expand Down Expand Up @@ -46,6 +46,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
query.ActionKeyword + " " + changeTo);
return false;
},
Score = score,
TitleToolTip = Constants.ToolTipOpenDirectory,
SubTitleToolTip = Constants.ToolTipOpenDirectory,
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed }
Expand All @@ -69,9 +70,9 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
if (retrievedDirectoryPath != path)
title = "Open " + folderName;


var subtitleFolderName = folderName;

// ie. max characters can be displayed without subtitle cutting off: "Program Files (x86)"
if (folderName.Length > 19)
subtitleFolderName = "the directory";
Expand All @@ -94,14 +95,15 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
};
}

internal static Result CreateFileResult(string filePath, Query query, bool showIndexState = false, bool windowsIndexed = false)
internal static Result CreateFileResult(string filePath, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
{
var result = new Result
{
Title = Path.GetFileName(filePath),
SubTitle = filePath,
IcoPath = filePath,
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
Score = score,
Action = c =>
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ internal async static Task<List<Result>> ExecuteWindowsIndexSearchAsync(string i
dataReaderResults.GetString(0),
path,
path,
query, true, true));
query, 0, true, true));
}
else
{
fileResults.Add(ResultManager.CreateFileResult(path, query, true, true));
fileResults.Add(ResultManager.CreateFileResult(path, query, 0, true, true));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we setting the score to 0 in several of the changes, have they always been 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we don't set the score before, which is default 0.

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
"Version": "1.7.2",
"Version": "1.7.3",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
Expand Down