javanna commented on code in PR #12348: URL: https://github.com/apache/lucene/pull/12348#discussion_r1224048429
########## lucene/core/src/java/org/apache/lucene/search/SliceExecutor.java: ########## @@ -18,22 +18,41 @@ package org.apache.lucene.search; import java.util.Collection; +import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; +import org.apache.lucene.index.LeafReaderContext; /** * Executor which is responsible for execution of slices based on the current status of the system * and current system load */ -class SliceExecutor { +public class SliceExecutor { + + /** Thresholds for index slice allocation logic */ + private static final int MAX_DOCS_PER_SLICE = 250_000; + + private static final int MAX_SEGMENTS_PER_SLICE = 5; + private final Executor executor; - SliceExecutor(Executor executor) { + public SliceExecutor(Executor executor) { this.executor = Objects.requireNonNull(executor, "Executor is null"); } - final void invokeAll(Collection<? extends Runnable> tasks) { + /** + * method to segregate LeafReaderContexts amongst multiple slices using the default + * MAX_SEGMENTS_PER_SLICE and MAX_DOCUMENTS_PER_SLICE + * + * @param leaves LeafReaderContexts for this index + * @return computed slices + */ + public LeafSlice[] computeSlices(List<LeafReaderContext> leaves) { + return IndexSearcher.slices(leaves, MAX_DOCS_PER_SLICE, MAX_SEGMENTS_PER_SLICE); Review Comment: you could still have the existing method call the one exposed by the SliceExecutor. -- 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