svoid deepDoubleWordIndex_add(DoubleWordIndex> wordIndex, A id, S text) { MultiMap positions = ciMultiMap(); for (IntRange r : wordIndex.wordRanges(text)) positions.put(substring(text, r), r.start); for (S word, L indices : positions.asMap()) wordIndex.addWord(new WithIntArray(toIntArray(indices), id), word); }