public final class TermStates extends Object
IndexReader TermState view over
IndexReader instances containing a single term. The
TermStates doesn't track if the given TermState
objects are valid, neither if the TermState instances refer to the
same terms in the associated readers.| Constructor and Description |
|---|
TermStates(IndexReaderContext context)
Creates an empty
TermStates from a IndexReaderContext |
TermStates(IndexReaderContext context,
TermState state,
int ord,
int docFreq,
long totalTermFreq)
|
| Modifier and Type | Method and Description |
|---|---|
void |
accumulateStatistics(int docFreq,
long totalTermFreq)
Expert: Accumulate term statistics.
|
static TermStates |
build(IndexReaderContext context,
Term term,
boolean needsStats)
|
void |
clear()
Clears the
TermStates internal state and removes all
registered TermStates |
int |
docFreq()
Returns the accumulated document frequency of all
TermState
instances passed to register(TermState, int, int, long). |
TermState |
get(LeafReaderContext ctx)
|
void |
register(TermState state,
int ord)
Expert: Registers and associates a
TermState with an leaf ordinal. |
void |
register(TermState state,
int ord,
int docFreq,
long totalTermFreq)
Registers and associates a
TermState with an leaf ordinal. |
String |
toString() |
long |
totalTermFreq()
Returns the accumulated term frequency of all
TermState
instances passed to register(TermState, int, int, long). |
boolean |
wasBuiltFor(IndexReaderContext context)
Expert: Return whether this
TermStates was built for the given
IndexReaderContext. |
public TermStates(IndexReaderContext context)
TermStates from a IndexReaderContextpublic TermStates(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
public boolean wasBuiltFor(IndexReaderContext context)
TermStates was built for the given
IndexReaderContext. This is typically used for assertions.public static TermStates build(IndexReaderContext context, Term term, boolean needsStats) throws IOException
TermStates from a top-level IndexReaderContext and the
given Term. This method will lookup the given term in all context's leaf readers
and register each of the readers containing the term in the returned TermStates
using the leaf reader's ordinal.
Note: the given context must be a top-level context.
needsStats - if true then all leaf contexts will be visited up-front to
collect term statistics. Otherwise, the TermState objects
will be built only when requestedIOExceptionpublic void clear()
TermStates internal state and removes all
registered TermStatespublic void register(TermState state, int ord, int docFreq, long totalTermFreq)
TermState with an leaf ordinal. The leaf ordinal
should be derived from a IndexReaderContext's leaf ord.public void register(TermState state, int ord)
TermState with an leaf ordinal. The
leaf ordinal should be derived from a IndexReaderContext's leaf ord.
On the contrary to register(TermState, int, int, long) this method
does NOT update term statistics.public void accumulateStatistics(int docFreq,
long totalTermFreq)
public TermState get(LeafReaderContext ctx) throws IOException
TermState for a leaf reader context or null if no
TermState for the context was registered.ctx - the LeafReaderContext to get the TermState for.TermState for the given readers ord or null if no
TermState for the reader was registeredIOExceptionpublic int docFreq()
TermState
instances passed to register(TermState, int, int, long).TermState
instances passed to register(TermState, int, int, long).public long totalTermFreq()
TermState
instances passed to register(TermState, int, int, long).TermState
instances passed to register(TermState, int, int, long).Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.