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

30
LINES

< > BotCompany Repo | #1029010 // Snippets Deep Double Word Index

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

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

!7

cprint SnippetsDeepDoubleWordIndex {
  transient DoubleWordIndex<WithIntArray<S>> wordIndex; // inner string = snippet ID, array = word positions in snippet

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

Author comment

Began life as a copy of #1029008

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: #1029010
Snippet name: Snippets Deep Double Word Index
Eternal ID of this version: #1029010/17
Text MD5: 12aa099a2405cab3a3d42c142156c8f8
Transpilation MD5: 4750810f97452fde38bdd3df48ea4182
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 22:38:57
Source code size: 1004 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 267 / 690
Version history: 16 change(s)
Referenced in: #1029014 - Instant Full-Text Snippet Search v4 [using deep double word index, OK]
#1029017 - Instant Full-Text Snippet Search v4.1 [using deep double word index, dev.]
#1029025 - Snippets Deep Word Index [OK]