Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1007531 // scoredSearch

JavaX fragment (include)

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: 563 / 579
Version history: 9 change(s)
Referenced in: [show references]