javanna commented on code in PR #13542: URL: https://github.com/apache/lucene/pull/13542#discussion_r1731253793
########## lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java: ########## @@ -890,11 +945,70 @@ public static class LeafSlice { * * @lucene.experimental */ - public final LeafReaderContext[] leaves; + public final LeafReaderContextPartition[] leaves; - public LeafSlice(List<LeafReaderContext> leavesList) { - Collections.sort(leavesList, Comparator.comparingInt(l -> l.docBase)); - this.leaves = leavesList.toArray(new LeafReaderContext[0]); + public LeafSlice(List<LeafReaderContextPartition> leafReaderContextPartitions) { + leafReaderContextPartitions.sort(Comparator.comparingInt(l -> l.ctx.docBase)); + // TODO should we sort by minDocId too? + this.leaves = leafReaderContextPartitions.toArray(new LeafReaderContextPartition[0]); + } + + /** + * Returns the total number of docs that a slice targets, by summing the number of docs that + * each of its leaf context partitions targets. + */ + public int getNumDocs() { + return Arrays.stream(leaves) Review Comment: correct -- 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