static LS scoredSearch(S query, Iterable<S> data) { new Map<S, Int> scores; LS searchTerms = scoredSearch_prepare(query); if (empty(searchTerms)) ret asList(data); for (S s : data) { int score = scoredSearch_score(s, searchTerms); if (score != 0) scores.put(s, score); } ret keysSortedByValuesDesc(scores); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1007531 |
Snippet name: | scoredSearch |
Eternal ID of this version: | #1007531/10 |
Text MD5: | 68fde7df9c0c402ea1655b006b152f1f |
Author: | stefan |
Category: | javax / text |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-16 23:56:08 |
Source code size: | 344 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 628 / 649 |
Version history: | 9 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1013292 - scoredSearch2 - with maxResults, faster? #1014217 - scoredSearch_field #1016997 - scoredSearch_eachTerm - only return results where each term matches |