private void SortSearchResults(List <AnalyzeResult> matches) { matches.Sort((a, b) => { return(_options.sortFn(a.score, b.score)); }); }
public static List <FuseResult <T> > Search(List <T> list, string pattern, FuseOptions <T> options, SearchOpts opts = null) { var searchers = PrepareSearchers(pattern, options); var search = InternalSearch(list, searchers.tokenSearchers, searchers.fullSearcher, options); ComputeScore(search); if (options.shouldSort) { search.results.Sort((a, b) => { return(options.sortFn(a.score, b.score)); }); } if (opts != null) { search.results = search.results.GetRange(0, opts.limit); } return(Format(search.results, options)); }