use of org.apache.cassandra.index.sasi.sa.SuffixSA in project cassandra by apache.
the class OnDiskIndexBuilder method finish.
@VisibleForTesting
protected boolean finish(Descriptor descriptor, File file) throws FSWriteError {
// no terms means there is nothing to build
if (terms.isEmpty())
return false;
// split terms into suffixes only if it's text, otherwise (even if CONTAINS is set) use terms in original form
SA sa = ((termComparator instanceof UTF8Type || termComparator instanceof AsciiType) && mode == Mode.CONTAINS) ? new SuffixSA(termComparator, mode) : new IntegralSA(termComparator, mode);
for (Map.Entry<ByteBuffer, TokenTreeBuilder> term : terms.entrySet()) sa.add(term.getKey(), term.getValue());
finish(descriptor, Pair.create(minKey, maxKey), file, sa.finish());
return true;
}
Aggregations