Uses 911K of libraries. Click here for Pure Java version (3492L/18K).
1 | !7 |
2 | |
3 | cmodule AgiBlueSearch > DynPrintLog {
|
4 | start {
|
5 | dm_registerAs_directLink('agiBlueSearch);
|
6 | warmUp(); |
7 | } |
8 | |
9 | void warmUp thread {
|
10 | temp enter(); |
11 | repeat 9 { search("test", quiet := true); }
|
12 | search("test"); // will print benchmark
|
13 | } |
14 | |
15 | // API |
16 | |
17 | void searchAndPost(S query, O... _) q {
|
18 | agiBlue_server_postSearchResult(query, collect q(search(query, _))); |
19 | } |
20 | |
21 | // searches page names only |
22 | // pass agiBlueBotID to use different agi.blue instance |
23 | L<virtual Page> search(S query, O... _) {
|
24 | optPar bool quiet; |
25 | optPar int maxResults = 100; |
26 | |
27 | //if (!quiet) print("Searching " + query);
|
28 | long time = sysNow(); |
29 | virtual Concepts concepts = optPar_func cc(_, () -> agiBlue_server_mainConcepts(_)); |
30 | L<virtual Page> pages = cast call(concepts, 'conceptsOfType, 'Page); |
31 | ScoredSearcher searcher = new(query); |
32 | searcher.maxResults = maxResults; |
33 | for (virtual Page page : pages) |
34 | searcher.put(page, getString q(page)); |
35 | L<virtual Page> result = searcher!; |
36 | if (!quiet) done2("Searched: " + query, time);
|
37 | ret result; |
38 | } |
39 | } |
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: | 505 / 2910 |
| Version history: | 20 change(s) |
| Referenced in: | [show references] |