public override Weight CreateWeight(IndexSearcher searcher)
{
IndexReaderContext context = searcher.TopReaderContext;
TermContext termState;
if (PerReaderTermState == null || PerReaderTermState.TopReaderContext != context)
{
// make TermQuery single-pass if we don't have a PRTS or if the context differs!
termState = TermContext.Build(context, Term_Renamed);
}
else
{
// PRTS was pre-build for this IS
termState = this.PerReaderTermState;
}
// we must not ignore the given docFreq - if set use the given value (lie)
if (DocFreq != -1)
{
termState.DocFreq = DocFreq;
}
return new TermWeight(this, searcher, termState);
}