/* Create the scorer used to score our associated DisjunctionMaxQuery */ public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer) { Scorer[] scorers = new Scorer[weights.Count]; int idx = 0; foreach (Weight w in weights) { Scorer subScorer = w.Scorer(reader, true, false); if (subScorer != null && subScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS) { scorers[idx++] = subScorer; } } if (idx == 0) { return(null); // all scorers did not have documents } DisjunctionMaxScorer result = new DisjunctionMaxScorer(Enclosing_Instance.tieBreakerMultiplier, similarity, scorers, idx); return(result); }
public override int NextDoc() { bool more; do { while (bucketTable.first != null) { // more queued current = bucketTable.first; bucketTable.first = current.next; // pop the queue // check prohibited & required, and minNrShouldMatch if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask && current.coord >= minNrShouldMatch) { return(doc = current.doc); } } // refill the queue more = false; end += BucketTable.SIZE; for (SubScorer sub = scorers; sub != null; sub = sub.next) { Scorer scorer = sub.scorer; sub.collector.SetScorer(scorer); int doc = scorer.DocID(); while (doc < end) { sub.collector.Collect(doc); doc = scorer.NextDoc(); } more |= (doc != NO_MORE_DOCS); } }while (bucketTable.first != null || more); return(this.doc = NO_MORE_DOCS); }