diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java index 0b0b7a599c4..152d5d5a15e 100644 --- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java +++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java @@ -2295,7 +2295,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit { SegmentMerger merger = new SegmentMerger(info, infoStream, trackingDir, config.getTermIndexInterval(), MergeState.CheckAbort.NONE, payloadProcessorProvider, - globalFieldNumberMap, codec, context); + globalFieldNumberMap, context); for (IndexReader reader : readers) { // add new indexes merger.add(reader); @@ -3439,7 +3439,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit { final TrackingDirectoryWrapper dirWrapper = new TrackingDirectoryWrapper(directory); SegmentMerger merger = new SegmentMerger(merge.info.info, infoStream, dirWrapper, config.getTermIndexInterval(), checkAbort, - payloadProcessorProvider, globalFieldNumberMap, codec, context); + payloadProcessorProvider, globalFieldNumberMap, context); if (infoStream.isEnabled("IW")) { infoStream.message("IW", "merging " + segString(merge.segments)); diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java b/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java index f81072a1502..f85e83ba0d2 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java @@ -59,7 +59,7 @@ final class SegmentMerger { // NOT the same!! SegmentMerger(SegmentInfo segmentInfo, InfoStream infoStream, Directory dir, int termIndexInterval, MergeState.CheckAbort checkAbort, PayloadProcessorProvider payloadProcessorProvider, - FieldInfos.FieldNumbers fieldNumbers, Codec codec, IOContext context) { + FieldInfos.FieldNumbers fieldNumbers, IOContext context) { mergeState.segmentInfo = segmentInfo; mergeState.infoStream = infoStream; mergeState.readers = new ArrayList(); @@ -67,7 +67,7 @@ final class SegmentMerger { mergeState.payloadProcessorProvider = payloadProcessorProvider; directory = dir; this.termIndexInterval = termIndexInterval; - this.codec = codec; + this.codec = segmentInfo.getCodec(); this.context = context; this.fieldInfosBuilder = new FieldInfos.Builder(fieldNumbers); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDoc.java b/lucene/core/src/test/org/apache/lucene/index/TestDoc.java index 0d26b9081e7..96187c878d3 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDoc.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDoc.java @@ -200,7 +200,7 @@ public class TestDoc extends LuceneTestCase { final SegmentInfo si = new SegmentInfo(si1.info.dir, Constants.LUCENE_MAIN_VERSION, merged, 10000, -1, merged, false, null, false, codec, null, null); SegmentMerger merger = new SegmentMerger(si, InfoStream.getDefault(), trackingDir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL, - MergeState.CheckAbort.NONE, null, new FieldInfos.FieldNumbers(), codec, context); + MergeState.CheckAbort.NONE, null, new FieldInfos.FieldNumbers(), context); merger.add(r1); merger.add(r2); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java b/lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java index 53918b3f31a..f2940b88272 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java @@ -80,7 +80,7 @@ public class TestSegmentMerger extends LuceneTestCase { final SegmentInfo si = new SegmentInfo(mergedDir, Constants.LUCENE_MAIN_VERSION, mergedSegment, 10000, -1, mergedSegment, false, null, false, codec, null, null); SegmentMerger merger = new SegmentMerger(si, InfoStream.getDefault(), mergedDir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL, - MergeState.CheckAbort.NONE, null, new FieldInfos.FieldNumbers(), codec, newIOContext(random())); + MergeState.CheckAbort.NONE, null, new FieldInfos.FieldNumbers(), newIOContext(random())); merger.add(reader1); merger.add(reader2); MergeState mergeState = merger.merge();