!7 cprint SnippetsDeepWordIndex { transient DeepWordIndex wordIndex; // string = snippet ID 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); wordIndex.add(snippetID, text); } setField(+wordIndex); } print("Indexed " + nWords(wordIndex.numWords())); } // API Iterable>> snippetsContainingTextIC_preSearch_withPositions(S query, O... _) { ret wordIndex.lookupString(query, _); } }