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

15
LINES

< > BotCompany Repo | #1012993 // smartBot_autoComplete - queries live from bot

JavaX fragment (include)

1  
// timeout on client side
2  
static long smartBot_autoComplete_defaultHardTimeout = 5000;
3  
static int smartBot_autoComplete_defaultMaxEntries = 10;
4  
5  
static L<S> smartBot_autoComplete(S s) {
6  
  L<Map> l = jsonDecodeList(loadPageWithTimeout("http://smartbot.botcompany.de/autocomplete/" + urlencode(s) + "?n=" + smartBot_autoComplete_defaultMaxEntries, smartBot_autoComplete_defaultHardTimeout));
7  
  new L<S> out;
8  
  for (Map map : l) {
9  
    S follow = getString(map, "follow");
10  
    if (nempty(follow)) continue with out.add(s + follow);
11  
    S whole = getString(map, "whole");
12  
    if (nempty(whole)) out.add(whole);
13  
  }
14  
  ret out;
15  
}

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: #1012993
Snippet name: smartBot_autoComplete - queries live from bot
Eternal ID of this version: #1012993/3
Text MD5: b2a2d321d15df2080e971637e6b75249
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-19 18:04:11
Source code size: 636 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 410 / 445
Version history: 2 change(s)
Referenced in: [show references]