mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Update browserbookmark plugin with new code
This commit is contained in:
@@ -40,9 +40,8 @@ namespace Wox.Plugin.BrowserBookmark
|
|||||||
|
|
||||||
if (!topResults)
|
if (!topResults)
|
||||||
{
|
{
|
||||||
// Since we mixed chrome and firefox bookmarks, we should order them again
|
// Since we mixed chrome and firefox bookmarks, we should order them again
|
||||||
var fuzzyMatcher = FuzzyMatcher.Create(param);
|
returnList = cachedBookmarks.Where(o => MatchProgram(o, param)).ToList();
|
||||||
returnList = cachedBookmarks.Where(o => MatchProgram(o, fuzzyMatcher)).ToList();
|
|
||||||
returnList = returnList.OrderByDescending(o => o.Score).ToList();
|
returnList = returnList.OrderByDescending(o => o.Score).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,11 +60,11 @@ namespace Wox.Plugin.BrowserBookmark
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool MatchProgram(Bookmark bookmark, FuzzyMatcher matcher)
|
private bool MatchProgram(Bookmark bookmark, string queryString)
|
||||||
{
|
{
|
||||||
if ((bookmark.Score = matcher.Evaluate(bookmark.Name).Score) > 0) return true;
|
if ((bookmark.Score = StringMatcher.FuzzySearch(queryString, bookmark.Name, new MatchOption()).Score) > 0) return true;
|
||||||
if ((bookmark.Score = matcher.Evaluate(bookmark.PinyinName).Score) > 0) return true;
|
if ((bookmark.Score = StringMatcher.FuzzySearch(queryString, bookmark.PinyinName, new MatchOption).Score) > 0) return true;
|
||||||
if ((bookmark.Score = matcher.Evaluate(bookmark.Url).Score / 10) > 0) return true;
|
if ((bookmark.Score = StringMatcher.FuzzySearch(queryString, bookmark.Url, new MatchOption()).Score / 10) > 0) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user