static L<S> scoredSearch2(int maxResults, S query, Iterable<S> data) { new MultiMap<Int, String> map; L<S> prepared = scoredSearch_prepare(query); for (S s : data) { int score = scoredSearch_score(s, prepared); if (score == 0) continue; map.put(score, s); } new L<S> out; for (int score : keysDesc(map)) { if (l(out) >= maxResults) break; int need = maxResults-l(out); out.addAll(takeFirst(need, map.get(score))); } ret out; }
Began life as a copy of #1007531
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1013292 |
Snippet name: | scoredSearch2 - with maxResults, faster? |
Eternal ID of this version: | #1013292/1 |
Text MD5: | 84e4d2e481cd722fd1daffce84a222f9 |
Author: | stefan |
Category: | javax / text |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-31 08:00:40 |
Source code size: | 481 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 475 / 504 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1013299 - scoredSearch3 - with Boyer-Moore |