From 06c4c204c80e3932aca22f4e7bba794d73d73cab Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 28 Jan 2011 23:12:22 +0000 Subject: [PATCH] LUCENE-2895: MockRandomCodec loads termsIndex even if termsIndexDivisor is set to -1 git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1064926 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java | 1 + .../lucene/index/codecs/mockrandom/MockRandomCodec.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java b/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java index 58b7cb8d9a6..dbd9ddbf1d0 100644 --- a/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java +++ b/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java @@ -31,6 +31,7 @@ public class TestSegmentInfo extends LuceneTestCase { Directory dir = newDirectory(); IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()); IndexWriter writer = new IndexWriter(dir, conf); + writer.setInfoStream(VERBOSE ? System.out : null); Document doc = new Document(); doc.add(new Field("a", "value", Store.YES, Index.ANALYZED)); writer.addDocument(doc); diff --git a/lucene/src/test/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java b/lucene/src/test/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java index d00854ec9f1..745c619cb87 100644 --- a/lucene/src/test/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java +++ b/lucene/src/test/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java @@ -260,7 +260,9 @@ public class MockRandomCodec extends Codec { if (LuceneTestCase.VERBOSE) { System.out.println("MockRandomCodec: variable-gap terms index (divisor=" + state.termsIndexDivisor + ")"); } - state.termsIndexDivisor = _TestUtil.nextInt(random, 1, 10); + if (state.termsIndexDivisor != -1) { + state.termsIndexDivisor = _TestUtil.nextInt(random, 1, 10); + } indexReader = new VariableGapTermsIndexReader(state.dir, state.fieldInfos, state.segmentInfo.name,