mayya-sharipova commented on a change in pull request #1351: LUCENE-9280:
Collectors to skip noncompetitive documents
URL: https://github.com/apache/lucene-solr/pull/1351#discussion_r395284149
##########
File path: lucene/core/src/java/org/apache/lucene/search/Weight.java
##########
@@ -201,20 +201,54 @@ public long cost() {
@Override
public int score(LeafCollector collector, Bits acceptDocs, int min, int
max) throws IOException {
collector.setScorer(scorer);
+ DocIdSetIterator scorerIterator = twoPhase == null? iterator:
twoPhase.approximation();
+ DocIdSetIterator combinedIterator = collector.iterator() == null ?
scorerIterator: combineScorerAndCollectorIterators(scorerIterator, collector);
if (scorer.docID() == -1 && min == 0 && max ==
DocIdSetIterator.NO_MORE_DOCS) {
- scoreAll(collector, iterator, twoPhase, acceptDocs);
+ scoreAll(collector, combinedIterator, twoPhase, acceptDocs);
return DocIdSetIterator.NO_MORE_DOCS;
} else {
int doc = scorer.docID();
- if (doc < min) {
- if (twoPhase == null) {
- doc = iterator.advance(min);
- } else {
- doc = twoPhase.approximation().advance(min);
+ if (doc < min) scorerIterator.advance(min);
+ return scoreRange(collector, combinedIterator, twoPhase, acceptDocs,
doc, max);
+ }
+ }
+
+ // conjunction iterator between scorer's iterator and collector's iterator
Review comment:
https://github.com/apache/lucene-solr/pull/1351/commits/d732d7eb9de67a597f67e91c9774104aa055e293
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]