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

!7

cprint SnippetsDoubleWordIndex {
  transient DoubleWordIndex<S> wordIndex; // word to snippet ID

  start-thread {
    time "Make double word index" {
      new DoubleWordIndex<S> wordIndex;
      for (virtual CSnippet sn : dm_allSnippets()) {
        S snippetID = (S) rcall snippetID(sn);
        S text = cast rcall text(sn);
        wordIndex.add(snippetID, text);
      }
      setField(+wordIndex);
    }
    print("Indexed " + nWords(wordIndex.numWords()));
  }
  
  // API
  
  // may return null (no pre-search result)
  Cl<S> snippetsContainingTextIC_preSearch(S query) {
    ret doubleWordIndex_lookupString(wordIndex, query);
  }
}

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: 117 / 430
Version history: 3 change(s)
Referenced in: [show references]