This elementary builder visitor invokes {@link it.unimi.dsi.mg4j.index.Index#documents(CharSequence)}to build the leaf {@linkplain it.unimi.dsi.mg4j.index.IndexIterator index iterators}. Thus, the resulting {@link it.unimi.dsi.mg4j.search.DocumentIterator} should be carefully{@linkplain it.unimi.dsi.mg4j.search.DocumentIterator#dispose() disposed} after usage (everyindex iterator may open a file or a socket).
{@link Prefix} and {@link MultiTerm} nodes cause the creation of a {@link MultiTermIndexIterator}, in the first case by calling {@link it.unimi.dsi.mg4j.index.Index#documents(CharSequence,int)} andin the second case by creating a {@link MultiTermIndexIterator} with the name and frequency equal to themaximum frequency over all terms. Other implementations might choose differently.
At construction time, you must provide a map from strings to indices that will be used to resolve {@link it.unimi.dsi.mg4j.query.nodes.Select} nodes. The map may be null
, in which casesuch nodes will cause an {@link java.lang.IllegalArgumentException}. If a {@link it.unimi.dsi.mg4j.query.nodes.Select}node contains an index name that does not appear in the map a {@link NoSuchElementException}will be thrown instead.
A production site will likely substitute this builder visitor with one that reuses {@linkplain it.unimi.dsi.mg4j.index.IndexReader index readers} out of a pool.
Instances of this class may be safely reused by calling {@link #prepare()}.
|
|