public final class TermContext extends Object
IndexReader
TermState
view over
IndexReader
instances containing a single term. The
TermContext
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 |
---|
TermContext(IndexReaderContext context)
Creates an empty
TermContext from a IndexReaderContext |
TermContext(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 TermContext |
build(IndexReaderContext context,
Term term)
|
void |
clear()
Clears the
TermContext internal state and removes all
registered TermState s |
int |
docFreq()
Returns the accumulated document frequency of all
TermState
instances passed to register(TermState, int, int, long) . |
TermState |
get(int ord)
|
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
TermContext was built for the given
IndexReaderContext . |
public TermContext(IndexReaderContext context)
TermContext
from a IndexReaderContext
public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
public boolean wasBuiltFor(IndexReaderContext context)
TermContext
was built for the given
IndexReaderContext
. This is typically used for assertions.public static TermContext build(IndexReaderContext context, Term term) throws IOException
TermContext
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 TermContext
using the leaf reader's ordinal.
Note: the given context must be a top-level context.
IOException
public void clear()
TermContext
internal state and removes all
registered TermState
spublic 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(int ord)
public 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-2017 Apache Software Foundation. All Rights Reserved.