Property TermIndexInterval
TermIndexInterval
Expert: Gets or sets the interval between indexed terms. Large values cause less memory to be used by IndexReader, but slow random-access to terms. Small values cause more memory to be used by an IndexReader, and speed random-access to terms.
This parameter determines the amount of computation required per query term, regardless of the number of documents that contain that term. In particular, it is the maximum number of other terms that must be scanned before a term is located and its frequency and position information may be processed. In a large index with user-entered query terms, query processing time is likely to be dominated not by term lookup but rather by the processing of frequency and positional data. In a small index or when many uncommon query terms are generated (e.g., by wildcard queries) term lookup may become a dominant cost.
In particular, numUniqueTerms/interval
terms are read into
memory by an IndexReader, and, on average, interval/2
terms
must be scanned for each random term access.
Takes effect immediately, but only applies to newly flushed/merged segments.
NOTE: this parameter does not apply to all PostingsFormat implementations, including the default one in this release. It only makes sense for term indexes that are implemented as a fixed gap between terms. For example, Lucene41PostingsFormat implements the term index instead based upon how terms share prefixes. To configure its parameters (the minimum and maximum size for a block), you would instead use Lucene41PostingsFormat(Int32, Int32). which can also be configured on a per-field basis:
public class MyLucene45Codec : Lucene45Codec
{
//customize Lucene41PostingsFormat, passing minBlockSize=50, maxBlockSize=100
private readonly PostingsFormat tweakedPostings = new Lucene41PostingsFormat(50, 100);
public override PostingsFormat GetPostingsFormatForField(string field)
{
if (field.Equals("fieldWithTonsOfTerms", StringComparison.Ordinal))
return tweakedPostings;
else
return base.GetPostingsFormatForField(field);
}
}
...
iwc.Codec = new MyLucene45Codec();
Note that other implementations may have their own parameters, or no parameters at all.
Declaration
public virtual int TermIndexInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |