vigyasharma commented on a change in pull request #633: URL: https://github.com/apache/lucene/pull/633#discussion_r822189054
########## File path: lucene/core/src/java/org/apache/lucene/index/MergePolicy.java ########## @@ -567,6 +605,21 @@ public abstract MergeSpecification findMerges( MergeTrigger mergeTrigger, SegmentInfos segmentInfos, MergeContext mergeContext) throws IOException; + /** + * Define {@link OneMerge} operations for a list of codec readers. This call is used to + * define merges for input readers in {@link IndexWriter#addIndexes(CodecReader...)}. + * Default implementation adds all readers to a single merge. This can be overridden in custom + * merge policies. + * + * @param readers set of readers to merge into the main index + */ + public MergeSpecification findMerges(List<CodecReader> readers) throws IOException { + OneMerge merge = new OneMerge(readers, leaf -> new MergeReader(leaf, leaf.getLiveDocs())); Review comment: Yes, this change will modify addIndexes to leverage `MergePolicy` and `MergeScheduler`, without changing its end behavior. I am thinking of doing a follow up PR with a merge policy that does a 1:1 addIndexes call, where the merger creates one segment each for every provided reader. It would create a faster, more concurrent `addIndexes(CodecReader...)`, at the cost of deferring some merges to be done later in background. Which, I believe is similar to the behavior in `addIndexes(Directory...)` - all incoming segments are simply added to IW, and any merging happens in later in background. -- 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