Class BlockTreeTermsReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Iterable<String>, Accountable

    public final class BlockTreeTermsReader
    extends FieldsProducer
    A block-based terms index and dictionary that assigns terms to variable length blocks according to how they share prefixes. The terms index is a prefix trie whose leaves are term blocks. The advantage of this approach is that seekExact is often able to determine a term cannot exist without doing any IO, and intersection with Automata is very fast. Note that this terms dictionary has its own fixed terms index (ie, it does not support a pluggable terms index implementation).

    NOTE: this terms dictionary supports min/maxItemsPerBlock during indexing to control how much memory the terms index uses.

    If auto-prefix terms were indexed (see BlockTreeTermsWriter), then the Terms.intersect(org.apache.lucene.util.automaton.CompiledAutomaton, org.apache.lucene.util.BytesRef) implementation here will make use of these terms only if the automaton has a binary sink state, i.e. an accept state which has a transition to itself accepting all byte values. For example, both PrefixQuery and TermRangeQuery pass such automata to Terms.intersect(org.apache.lucene.util.automaton.CompiledAutomaton, org.apache.lucene.util.BytesRef).

    The data structure used by this implementation is very similar to a burst trie (, but with added logic to break up too-large blocks of all terms sharing a given prefix into smaller ones.

    Use CheckIndex with the -verbose option to see summary statistics on the blocks in the dictionary. See BlockTreeTermsWriter.

    WARNING: This API is experimental and might change in incompatible ways in the next release.