internal SlowMinShouldMatchScorer(BooleanWeight weight, AtomicReader reader, IndexSearcher searcher)
: base(weight)
{
this.Dv = reader.GetSortedSetDocValues("dv");
this.MaxDoc = reader.MaxDoc;
BooleanQuery bq = (BooleanQuery)weight.Query;
this.MinNrShouldMatch = bq.MinimumNumberShouldMatch;
this.Sims = new SimScorer[(int)Dv.ValueCount];
foreach (BooleanClause clause in bq.Clauses)
{
Debug.Assert(!clause.Prohibited);
Debug.Assert(!clause.Required);
Term term = ((TermQuery)clause.Query).Term;
long ord = Dv.LookupTerm(term.Bytes());
if (ord >= 0)
{
bool success = Ords.Add(ord);
Debug.Assert(success); // no dups
TermContext context = TermContext.Build(reader.Context, term);
SimWeight w = weight.Similarity.ComputeWeight(1f, searcher.CollectionStatistics("field"), searcher.TermStatistics(term, context));
var dummy = w.ValueForNormalization; // ignored
w.Normalize(1F, 1F);
Sims[(int)ord] = weight.Similarity.DoSimScorer(w, (AtomicReaderContext)reader.Context);
}
}
}