1 | static LS scoredSearch(S query, Iterable<S> data) { |
2 | new Map<S, Int> scores; |
3 | LS searchTerms = scoredSearch_prepare(query); |
4 | if (empty(searchTerms)) ret asList(data); |
5 | for (S s : data) { |
6 | int score = scoredSearch_score(s, searchTerms); |
7 | if (score != 0) |
8 | scores.put(s, score); |
9 | } |
10 | ret keysSortedByValuesDesc(scores); |
11 | } |
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: | 629 / 651 |
Version history: | 9 change(s) |
Referenced in: | [show references] |