!7 cprint SnippetsDeepDoubleWordIndex { transient DoubleWordIndex> wordIndex; // inner string = snippet ID, array = word positions in snippet start-thread { time "Make double word index" { print("Making index"); new DoubleWordIndex> 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 snippetsContainingTextIC_preSearch(S query, O... _) { ret deepDoubleWordIndex_lookupString(wordIndex, query, _); } Iterable>> snippetsContainingTextIC_preSearch_withPositions(S query, O... _) { ret deepDoubleWordIndex_lookupString_withPositions(wordIndex, query, _); } }