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

25
LINES

< > BotCompany Repo | #1028972 // Snippets Word Index [OK]

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

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

1  
!7
2  
3  
cprint SnippetsWordIndex {
4  
  transient WordIndex<S> wordIndex; // word to snippet ID
5  
6  
  start-thread {
7  
    time "Make word index" {
8  
      new WordIndex<S> wordIndex;
9  
      for (virtual CSnippet sn : dm_allSnippets()) {
10  
        S snippetID = (S) rcall snippetID(sn);
11  
        S text = cast rcall text(sn);
12  
        wordIndex.add(snippetID, text);
13  
      }
14  
      setField(+wordIndex);
15  
    }
16  
    print("Indexed " + nWords(wordIndex.numWords()));
17  
  }
18  
  
19  
  // API
20  
  
21  
  // may return null (no pre-search result)
22  
  Cl<S> snippetsContainingTextIC_preSearch(S query) {
23  
    ret wordIndex_lookupString(wordIndex, query);
24  
  }
25  
}

Author comment

Began life as a copy of #1028945

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1028972
Snippet name: Snippets Word Index [OK]
Eternal ID of this version: #1028972/7
Text MD5: 497fc56a2d28ac67b2eb04c53ed0a751
Transpilation MD5: 561526dc93a785113154d16f6f450650
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-15 02:04:32
Source code size: 642 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 264 / 2652
Version history: 6 change(s)
Referenced in: [show references]