mayya-sharipova commented on a change in pull request #1955:
URL: https://github.com/apache/lucene-solr/pull/1955#discussion_r500673813
##########
File path: lucene/core/src/java/org/apache/lucene/search/Weight.java
##########
@@ -204,21 +204,21 @@ public int score(LeafCollector collector, Bits
acceptDocs, int min, int max) thr
collector.setScorer(scorer);
DocIdSetIterator scorerIterator = twoPhase == null ? iterator :
twoPhase.approximation();
DocIdSetIterator collectorIterator = collector.competitiveIterator();
- DocIdSetIterator filteredIterator;
- if (collectorIterator == null) {
- filteredIterator = scorerIterator;
- } else {
- if (scorerIterator.docID() != -1) {
- // Wrap ScorerIterator to start from -1 for conjunction
- scorerIterator = new RangeDISIWrapper(scorerIterator, max);
- }
- // filter scorerIterator to keep only competitive docs as defined by
collector
- filteredIterator =
ConjunctionDISI.intersectIterators(Arrays.asList(scorerIterator,
collectorIterator));
- }
+ DocIdSetIterator filteredIterator = scorerIterator;
if (filteredIterator.docID() == -1 && min == 0 && max ==
DocIdSetIterator.NO_MORE_DOCS) {
+ if (collectorIterator != null) {
+ filteredIterator =
ConjunctionDISI.intersectIterators(Arrays.asList(scorerIterator,
collectorIterator));
+ }
scoreAll(collector, filteredIterator, twoPhase, acceptDocs);
return DocIdSetIterator.NO_MORE_DOCS;
} else {
+ if (collectorIterator != null) {
+ if (scorerIterator.docID() != -1) {
+ // here we assume that the initial version of collectorIterator
matches all docs and can advance exactly to the desired docID
Review comment:
Thanks for the comment, I will think about this more
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]