Search in sources :

Example 1 with SuffixSA

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;
}
Also used : IntegralSA(org.apache.cassandra.index.sasi.sa.IntegralSA) SuffixSA(org.apache.cassandra.index.sasi.sa.SuffixSA) ByteBuffer(java.nio.ByteBuffer) SA(org.apache.cassandra.index.sasi.sa.SA) SuffixSA(org.apache.cassandra.index.sasi.sa.SuffixSA) IntegralSA(org.apache.cassandra.index.sasi.sa.IntegralSA) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ByteBuffer (java.nio.ByteBuffer)1 IntegralSA (org.apache.cassandra.index.sasi.sa.IntegralSA)1 SA (org.apache.cassandra.index.sasi.sa.SA)1 SuffixSA (org.apache.cassandra.index.sasi.sa.SuffixSA)1