|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.index.TermContext
public final class TermContext
Maintains a 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.
Field Summary | |
---|---|
IndexReaderContext |
topReaderContext
Holds the IndexReaderContext of the top-level
IndexReader , used internally only for
asserting. |
Constructor Summary | |
---|---|
TermContext(IndexReaderContext context)
Creates an empty TermContext from a IndexReaderContext |
|
TermContext(IndexReaderContext context,
TermState state,
int ord,
int docFreq,
long totalTermFreq)
Creates a TermContext with an initial TermState ,
IndexReader pair. |
Method Summary | |
---|---|
static TermContext |
build(IndexReaderContext context,
Term term,
boolean cache)
Creates a TermContext from a top-level IndexReaderContext and the
given 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)
Returns the TermState for an leaf ordinal or null if no
TermState for the ordinal was registered. |
void |
register(TermState state,
int ord,
int docFreq,
long totalTermFreq)
Registers and associates a TermState with an leaf ordinal. |
void |
setDocFreq(int docFreq)
expert: only available for queries that want to lie about docfreq |
long |
totalTermFreq()
Returns the accumulated term frequency of all TermState
instances passed to register(TermState, int, int, long) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final IndexReaderContext topReaderContext
IndexReaderContext
of the top-level
IndexReader
, used internally only for
asserting.
Constructor Detail |
---|
public TermContext(IndexReaderContext context)
TermContext
from a IndexReaderContext
public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
TermContext
with an initial TermState
,
IndexReader
pair.
Method Detail |
---|
public static TermContext build(IndexReaderContext context, Term term, boolean cache) 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
s
public 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 TermState get(int ord)
TermState
for an leaf ordinal or null
if no
TermState
for the ordinal was registered.
ord
- the readers leaf ordinal to get the TermState
for.
TermState
for the given readers ord or null
if no
TermState
for the reader was registeredpublic 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)
.public void setDocFreq(int docFreq)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |