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

39
LINES

< > BotCompany Repo | #1024057 // agi.blue Search Module [LIVE]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (3492L/18K).

!7

cmodule AgiBlueSearch > DynPrintLog {
  start {
    dm_registerAs_directLink('agiBlueSearch);
    warmUp();
  }
  
  void warmUp thread {
    temp enter();
    repeat 9 { search("test", quiet := true); }
    search("test"); // will print benchmark
  }
  
  // API
  
  void searchAndPost(S query, O... _) q {
    agiBlue_server_postSearchResult(query, collect q(search(query, _)));
  }
  
  // searches page names only
  // pass agiBlueBotID to use different agi.blue instance
  L<virtual Page> search(S query, O... _) {
    optPar bool quiet;
    optPar int maxResults = 100;

    //if (!quiet) print("Searching " + query);
    long time = sysNow();
    virtual Concepts concepts = optPar_func cc(_, () -> agiBlue_server_mainConcepts(_));
    L<virtual Page> pages = cast call(concepts, 'conceptsOfType, 'Page);
    ScoredSearcher searcher = new(query);
    searcher.maxResults = maxResults;
    for (virtual Page page : pages)
      searcher.put(page, getString q(page));
    L<virtual Page> result =  searcher!;
    if (!quiet) done2("Searched: " + query, time);
    ret result;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1024057
Snippet name: agi.blue Search Module [LIVE]
Eternal ID of this version: #1024057/21
Text MD5: da552ea34dbc3f90832514a33399dbab
Transpilation MD5: 49f7bf50f298c9d00fb43376f43c0fdf
Author: stefan
Category: javax / agi.blue
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-30 15:24:28
Source code size: 1129 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 285 / 2629
Version history: 20 change(s)
Referenced in: