jpountz commented on code in PR #14714: URL: https://github.com/apache/lucene/pull/14714#discussion_r2124821293
########## lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java: ########## @@ -32,31 +34,21 @@ public class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> { private final ScoreDoc after; + private final LongHeap heap; final int totalHitsThreshold; final MaxScoreAccumulator minScoreAcc; // prevents instantiation TopScoreDocCollector( int numHits, ScoreDoc after, int totalHitsThreshold, MaxScoreAccumulator minScoreAcc) { - super(new HitQueue(numHits, true)); + super(null); + this.heap = new LongHeap(numHits); + IntStream.range(0, numHits).forEach(_ -> heap.push(DocScoreEncoder.LEAST_COMPETITIVE_CODE)); Review Comment: Nit: a for loop would be a bit more readable? -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org