mirror of https://github.com/apache/lucene.git
TestCompressingStoredFieldsFormat: test merging against a non-compressing codec.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1416084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
589fff01b3
commit
c62c57ed5a
|
@ -25,7 +25,8 @@ import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.codecs.lucene41.Lucene41Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.simpletext.SimpleTextCodec;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.DoubleField;
|
import org.apache.lucene.document.DoubleField;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -59,6 +60,8 @@ import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||||
|
|
||||||
public class TestCompressingStoredFieldsFormat extends LuceneTestCase {
|
public class TestCompressingStoredFieldsFormat extends LuceneTestCase {
|
||||||
|
|
||||||
|
private static final Codec NON_COMPRESSING_CODEC = new SimpleTextCodec();
|
||||||
|
|
||||||
private Directory dir;
|
private Directory dir;
|
||||||
IndexWriterConfig iwConf;
|
IndexWriterConfig iwConf;
|
||||||
private RandomIndexWriter iw;
|
private RandomIndexWriter iw;
|
||||||
|
@ -119,11 +122,11 @@ public class TestCompressingStoredFieldsFormat extends LuceneTestCase {
|
||||||
iw.w.addDocument(doc);
|
iw.w.addDocument(doc);
|
||||||
if (random().nextBoolean() && (i % (data.length / 10) == 0)) {
|
if (random().nextBoolean() && (i % (data.length / 10) == 0)) {
|
||||||
iw.w.close();
|
iw.w.close();
|
||||||
// switch codecs
|
// test merging against a non-compressing codec
|
||||||
if (iwConf.getCodec() instanceof Lucene41Codec) {
|
if (iwConf.getCodec() == NON_COMPRESSING_CODEC) {
|
||||||
iwConf.setCodec(CompressingCodec.randomInstance(random()));
|
iwConf.setCodec(CompressingCodec.randomInstance(random()));
|
||||||
} else {
|
} else {
|
||||||
iwConf.setCodec(new Lucene41Codec());
|
iwConf.setCodec(NON_COMPRESSING_CODEC);
|
||||||
}
|
}
|
||||||
iw = new RandomIndexWriter(random(), dir, iwConf);
|
iw = new RandomIndexWriter(random(), dir, iwConf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue