Github user jimczi commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/495#discussion_r232836836 --- 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); --- End diff -- You don't need a real wrapper. An anonymous class should be enough: ``` this.twoPhaseIterator = new TwoPhaseIterator(approx) { @Override public boolean matches() throws IOException { return twoPhaseIterator.matches(); } @Override public float matchCost() { return twoPhaseIterator.matchCost(); } }; ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org