TextIndexQuery (@NotNull Collection<String> words, boolean caseSensitively, boolean useOnlyWeakHashToSearch, @Nullable Short context) { Set<IdIndexEntry> keys = CollectionFactory.createSmallMemoryFootprintSet(ContainerUtil.flatMap(words, w -> getWordEntries(w, caseSensitively))); IntSet trigrams; if (!useOnlyWeakHashToSearch) { trigrams = new IntOpenHashSet(); for (String word : words) { trigrams.addAll(TrigramBuilder.getTrigrams(word)); } } else { trigrams = IntSets.EMPTY_SET; } return new TextIndexQuery(keys, trigrams, context, useOnlyWeakHashToSearch, words); }