LUCENE-4775: speed up test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1447034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-02-17 16:00:44 +00:00
parent 2c95e26af2
commit 32a43cd1ee
1 changed files with 12 additions and 4 deletions

View File

@ -24,8 +24,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
@ -343,14 +345,20 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
public void testTotalBytesSize() throws Exception {
Directory d = newDirectory();
if (d instanceof MockDirectoryWrapper) {
((MockDirectoryWrapper)d).setThrottling(MockDirectoryWrapper.Throttling.NEVER);
}
IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
iwc.setMaxBufferedDocs(5);
iwc.setMergeScheduler(new TrackingCMS());
RandomIndexWriter w = new RandomIndexWriter(random(), d);
for(int i=0;i<100000;i++) {
if (_TestUtil.getPostingsFormat("id").equals("SimpleText")) {
// no
iwc.setCodec(_TestUtil.alwaysPostingsFormat(new Lucene41PostingsFormat()));
}
RandomIndexWriter w = new RandomIndexWriter(random(), d, iwc);
for(int i=0;i<1000;i++) {
Document doc = new Document();
doc.add(newStringField("id", ""+i, Field.Store.NO));
doc.add(newTextField("field", "here is some text", Field.Store.NO));
doc.add(new StringField("id", ""+i, Field.Store.NO));
w.addDocument(doc);
if (random().nextBoolean()) {