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

35
LINES

< > BotCompany Repo | #1020465 // Improve Quick Search [using meta-info for modules]

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

Libraryless. Click here for Pure Java version (16497L/116K).

1  
!7
2  
3  
module ProcessMetaInfo > DynPrintLogAndEnabled {
4  
  start {
5  
    dm_requireQuickSearchManager();
6  
    dm_useLocalMechListCopies();
7  
    dm_onTopInputChanged_q(voidfunc(S s) { doSearch(s) });
8  
  }
9  
  
10  
  void doSearch(S s) {
11  
    new L<Map> results;
12  
    new Matches m;
13  
    for (S mod : dm_listModuleIDs()) {
14  
      LS keywords = tok_splitAtComma_emptyOnNull(getColonProperty("Keywords", mL("Meta info for module " + dm_programID(mod))));
15  
      if (empty(keywords)) continue;
16  
      new Set<S> remainingTerms;
17  
      print("Got keywords: " + keywords);
18  
      for (S keyword : keywords) {
19  
        if (matchStart(keyword, s, m))
20  
          remainingTerms.add(m.rest());
21  
        if (matchEnd(keyword, s, m))
22  
          remainingTerms.add(m.rest());
23  
      }
24  
      if (empty(remainingTerms)) continue;
25  
      print("Got rt: " + remainingTerms);
26  
      //for (S rt : remainingTerms)
27  
        results.add(litmap(
28  
          a := dm_moduleIDAndNameForQuickSearch(mod),
29  
          b := litmap(defaultAction := r {
30  
            infoBox("Test")
31  
          })));
32  
    }
33  
    dm_call(dm_quickSearchManager(), 'setResultsForModule, dm_moduleID(), "", s, results, new O[] {});
34  
  }
35  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020465
Snippet name: Improve Quick Search [using meta-info for modules]
Eternal ID of this version: #1020465/9
Text MD5: 95a914bdffcbbe9be4261b363a71dcaa
Transpilation MD5: 399c357b200b862f669b6d231c1e5add
Author: stefan
Category: javax / stefan's os / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-23 16:21:48
Source code size: 1181 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 264 / 1062
Version history: 8 change(s)
Referenced in: [show references]