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).

!7

module ProcessMetaInfo > DynPrintLogAndEnabled {
  start {
    dm_requireQuickSearchManager();
    dm_useLocalMechListCopies();
    dm_onTopInputChanged_q(voidfunc(S s) { doSearch(s) });
  }
  
  void doSearch(S s) {
    new L<Map> results;
    new Matches m;
    for (S mod : dm_listModuleIDs()) {
      LS keywords = tok_splitAtComma_emptyOnNull(getColonProperty("Keywords", mL("Meta info for module " + dm_programID(mod))));
      if (empty(keywords)) continue;
      new Set<S> remainingTerms;
      print("Got keywords: " + keywords);
      for (S keyword : keywords) {
        if (matchStart(keyword, s, m))
          remainingTerms.add(m.rest());
        if (matchEnd(keyword, s, m))
          remainingTerms.add(m.rest());
      }
      if (empty(remainingTerms)) continue;
      print("Got rt: " + remainingTerms);
      //for (S rt : remainingTerms)
        results.add(litmap(
          a := dm_moduleIDAndNameForQuickSearch(mod),
          b := litmap(defaultAction := r {
            infoBox("Test")
          })));
    }
    dm_call(dm_quickSearchManager(), 'setResultsForModule, dm_moduleID(), "", s, results, new O[] {});
  }
}

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: 260 / 1056
Version history: 8 change(s)
Referenced in: [show references]