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

25
LINES

< > BotCompany Repo | #1029008 // Snippets Double 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 (4292L/21K).

1  
!7
2  
3  
cprint SnippetsDoubleWordIndex {
4  
  transient DoubleWordIndex<S> wordIndex; // word to snippet ID
5  
6  
  start-thread {
7  
    time "Make double word index" {
8  
      new DoubleWordIndex<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 doubleWordIndex_lookupString(wordIndex, query);
24  
  }
25  
}

Author comment

Began life as a copy of #1028972

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: #1029008
Snippet name: Snippets Double Word Index [OK]
Eternal ID of this version: #1029008/4
Text MD5: 7e63d19badb44acacf9ca3d6514bf5d7
Transpilation MD5: 2d7d0b8fc2a06bdf1f120793c61abe75
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-16 19:24:38
Source code size: 673 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 517
Version history: 3 change(s)
Referenced in: [show references]