Github user jimczi commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/495#discussion_r232835412
  
    --- Diff: 
lucene/core/src/java/org/apache/lucene/search/ConstantScoreScorer.java ---
    @@ -49,15 +100,27 @@ public ConstantScoreScorer(Weight weight, float score, 
DocIdSetIterator disi) {
       public ConstantScoreScorer(Weight weight, float score, TwoPhaseIterator 
twoPhaseIterator) {
         super(weight);
         this.score = score;
    -    this.twoPhaseIterator = twoPhaseIterator;
    -    this.disi = TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator);
    +    this.approximation = new 
DocIdSetIteratorWrapper(twoPhaseIterator.approximation());
    +    this.twoPhaseIterator = new TwoPhaseIteratorWrapper(twoPhaseIterator, 
this.approximation);
    +    this.disi = new 
DocIdSetIteratorWrapper(TwoPhaseIterator.asDocIdSetIterator(this.twoPhaseIterator));
    --- End diff --
    
    You don't need to use an extra wrapper here. 
`TwoPhaseIterator.asDocIdSetIterator(this.twoPhaseIterator)` will use the 
wrapped `approximation` so you can directly reset `approximation.delegate` when 
you want to early terminate the collection. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to