From 7406e1de0f65c3d001badae371f6dca81f585c55 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Fri, 15 Aug 2014 10:19:33 +0000 Subject: [PATCH] improve test reproducibility and try to use more terms dicts impls git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1618141 13f79535-47bb-0310-9956-ffa450edef68 --- .../TestLucene410DocValuesFormat.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene410/TestLucene410DocValuesFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene410/TestLucene410DocValuesFormat.java index ff7af8c601c..6e14dc4c814 100644 --- a/lucene/core/src/test/org/apache/lucene/codecs/lucene410/TestLucene410DocValuesFormat.java +++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene410/TestLucene410DocValuesFormat.java @@ -25,7 +25,10 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.DocValuesFormat; import org.apache.lucene.codecs.PostingsFormat; +import org.apache.lucene.codecs.blocktreeords.Ords41PostingsFormat; import org.apache.lucene.codecs.lucene41ords.Lucene41WithOrds; +import org.apache.lucene.codecs.memory.FSTOrdPostingsFormat; +import org.apache.lucene.codecs.memory.FSTOrdPulsing41PostingsFormat; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.SortedSetDocValuesField; @@ -36,6 +39,7 @@ import org.apache.lucene.index.BaseCompressingDocValuesFormatTestCase; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.SerialMergeScheduler; import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; @@ -115,9 +119,22 @@ public class TestLucene410DocValuesFormat extends BaseCompressingDocValuesFormat // the postings format correctly. private void doTestTermsEnumRandom(int numDocs, int minLength, int maxLength) throws Exception { Directory dir = newFSDirectory(createTempDir()); - IndexWriterConfig conf = new IndexWriterConfig(new MockAnalyzer(random())); + IndexWriterConfig conf = newIndexWriterConfig(new MockAnalyzer(random())); + conf.setMergeScheduler(new SerialMergeScheduler()); // set to duel against a codec which has ordinals: - final PostingsFormat pf = new Lucene41WithOrds(); + final PostingsFormat pf; + switch (random().nextInt(2)) { + case 0: pf = new Lucene41WithOrds(); + break; + case 1: pf = new Ords41PostingsFormat(); + break; + // TODO: these don't actually support ords! + //case 2: pf = new FSTOrdPostingsFormat(); + // break; + //case 3: pf = new FSTOrdPulsing41PostingsFormat(); + // break; + default: throw new AssertionError(); + } final DocValuesFormat dv = new Lucene410DocValuesFormat(); conf.setCodec(new Lucene410Codec() { @Override