Index: lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsWriter.java =================================================================== --- lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsWriter.java (revision 1091277) +++ lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsWriter.java (working copy) @@ -50,12 +50,13 @@ * smaller indexes, greater acceleration, but fewer accelerable cases, while * smaller values result in bigger indexes, less acceleration and more * accelerable cases. More detailed experiments would be useful here. */ - final int skipInterval = 16; + static final int DEFAULT_SKIP_INTERVAL = 16; + final int skipInterval; /** * Expert: minimum docFreq to write any skip data at all */ - final int skipMinimum = skipInterval; + final int skipMinimum; /** Expert: The maximum number of skip levels. Smaller values result in * slightly smaller indexes, but slower skipping in big posting lists. @@ -82,7 +83,12 @@ private RAMOutputStream bytesWriter = new RAMOutputStream(); public StandardPostingsWriter(SegmentWriteState state) throws IOException { + this(state, DEFAULT_SKIP_INTERVAL); + } + public StandardPostingsWriter(SegmentWriteState state, int skipInterval) throws IOException { super(); + this.skipInterval = skipInterval; + this.skipMinimum = skipInterval; /* set to the same for now */ //this.segment = state.segmentName; String fileName = IndexFileNames.segmentFileName(state.segmentName, state.codecId, StandardCodec.FREQ_EXTENSION); freqOut = state.directory.createOutput(fileName); Index: lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriterImpl.java =================================================================== --- lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriterImpl.java (revision 1091277) +++ lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriterImpl.java (working copy) @@ -69,12 +69,13 @@ * smaller indexes, greater acceleration, but fewer accelerable cases, while * smaller values result in bigger indexes, less acceleration and more * accelerable cases. More detailed experiments would be useful here. */ - final int skipInterval = 16; + final int skipInterval; + static final int DEFAULT_SKIP_INTERVAL = 16; /** * Expert: minimum docFreq to write any skip data at all */ - final int skipMinimum = skipInterval; + final int skipMinimum; /** Expert: The maximum number of skip levels. Smaller values result in * slightly smaller indexes, but slower skipping in big posting lists. @@ -102,8 +103,13 @@ private final RAMOutputStream indexBytesWriter = new RAMOutputStream(); public SepPostingsWriterImpl(SegmentWriteState state, IntStreamFactory factory) throws IOException { + this(state, factory, DEFAULT_SKIP_INTERVAL); + } + + public SepPostingsWriterImpl(SegmentWriteState state, IntStreamFactory factory, int skipInterval) throws IOException { super(); - + this.skipInterval = skipInterval; + this.skipMinimum = skipInterval; /* set to the same for now */ final String docFileName = IndexFileNames.segmentFileName(state.segmentName, state.codecId, DOC_EXTENSION); docOut = factory.createOutput(state.directory, docFileName); docIndex = docOut.index(); Index: lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java (revision 1091277) +++ lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java (working copy) @@ -135,13 +135,20 @@ final Random random = new Random(seed); PostingsWriterBase postingsWriter; + // TODO: intentionally made a new random here to not interfere with mockrandom's magical seeding!!! + // maybe this code should be moved to before it writes the seed at all?! + int skipInterval = _TestUtil.nextInt(new Random(seed), 2, 64); + if (LuceneTestCase.VERBOSE) { + System.out.println("MockRandomCodec: skipInterval=" + skipInterval); + } + if (random.nextBoolean()) { - postingsWriter = new SepPostingsWriterImpl(state, new MockIntStreamFactory(random)); + postingsWriter = new SepPostingsWriterImpl(state, new MockIntStreamFactory(random), skipInterval); } else { if (LuceneTestCase.VERBOSE) { System.out.println("MockRandomCodec: writing Standard postings"); } - postingsWriter = new StandardPostingsWriter(state); + postingsWriter = new StandardPostingsWriter(state, skipInterval); } if (random.nextBoolean()) {