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.
Inheritance
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public sealed class TermContext : object
Constructors
| Improve this Doc View SourceTermContext(IndexReaderContext)
Creates an empty TermContext from a IndexReaderContext
Declaration
public TermContext(IndexReaderContext context)
Parameters
Type | Name | Description |
---|---|---|
IndexReaderContext | context |
TermContext(IndexReaderContext, TermState, Int32, Int32, Int64)
Creates a TermContext with an initial TermState, IndexReader pair.
Declaration
public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
Parameters
Type | Name | Description |
---|---|---|
IndexReaderContext | context | |
TermState | state | |
System.Int32 | ord | |
System.Int32 | docFreq | |
System.Int64 | totalTermFreq |
Properties
| Improve this Doc View SourceDocFreq
expert: only available for queries that want to lie about docfreq
Declaration
public int DocFreq { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TopReaderContext
Holds the IndexReaderContext of the top-level IndexReader, used internally only for asserting.
Declaration
public IndexReaderContext TopReaderContext { get; }
Property Value
Type | Description |
---|---|
IndexReaderContext |
TotalTermFreq
Returns the accumulated term frequency of all TermState instances passed to Register(TermState, Int32, Int32, Int64).
Declaration
public long TotalTermFreq { get; }
Property Value
Type | Description |
---|---|
System.Int64 | the accumulated term frequency of all TermState instances passed to Register(TermState, Int32, Int32, Int64). |
Methods
| Improve this Doc View SourceBuild(IndexReaderContext, Term)
Creates a 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.
Declaration
public static TermContext Build(IndexReaderContext context, Term term)
Parameters
Type | Name | Description |
---|---|---|
IndexReaderContext | context | |
Term | term |
Returns
Type | Description |
---|---|
TermContext |
Clear()
Clears the TermContext internal state and removes all registered TermStates
Declaration
public void Clear()
Get(Int32)
Declaration
public TermState Get(int ord)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ord | The readers leaf ordinal to get the TermState for. |
Returns
Type | Description |
---|---|
TermState | The TermState for the given readers ord or |
Register(TermState, Int32, Int32, Int64)
Registers and associates a TermState with an leaf ordinal. The leaf ordinal should be derived from a IndexReaderContext's leaf ord.
Declaration
public void Register(TermState state, int ord, int docFreq, long totalTermFreq)
Parameters
Type | Name | Description |
---|---|---|
TermState | state | |
System.Int32 | ord | |
System.Int32 | docFreq | |
System.Int64 | totalTermFreq |