jpountz commented on code in PR #12622: URL: https://github.com/apache/lucene/pull/12622#discussion_r1402394564
########## lucene/core/src/java/org/apache/lucene/index/IndexWriter.java: ########## @@ -5160,20 +5177,74 @@ public int length() { } mergeReaders.add(wrappedReader); } + + MergeState.DocMap[] reorderDocMaps = null; + if (config.getIndexSort() == null) { + // Create a merged view of the input segments. This effectively does the merge. + CodecReader mergedView = SlowCompositeCodecReaderWrapper.wrap(mergeReaders); + Sorter.DocMap docMap = merge.reorder(mergedView, directory); + if (docMap != null) { + reorderDocMaps = new MergeState.DocMap[mergeReaders.size()]; + int docBase = 0; + int i = 0; + for (CodecReader reader : mergeReaders) { + final int currentDocBase = docBase; + reorderDocMaps[i] = + new MergeState.DocMap() { Review Comment: I'll leave it to you for a follow-up. :) -- 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