if we get MockRandomMergePolicy, which is O(N^2), use smaller index

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1416281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-12-02 22:49:46 +00:00
parent 014d5195ed
commit f8795d25a5
2 changed files with 11 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@ -47,7 +48,9 @@ public class TestBagOfPositions extends LuceneTestCase {
final int maxTermsPerDoc = _TestUtil.nextInt(random(), 10, 20);
boolean isSimpleText = "SimpleText".equals(_TestUtil.getPostingsFormat("field"));
if (isSimpleText && (TEST_NIGHTLY || RANDOM_MULTIPLIER > 1)) {
IndexWriterConfig iwc = newIndexWriterConfig(random(), TEST_VERSION_CURRENT, new MockAnalyzer(random()));
if ((isSimpleText || iwc.getMergePolicy() instanceof MockRandomMergePolicy) && (TEST_NIGHTLY || RANDOM_MULTIPLIER > 1)) {
// Otherwise test can take way too long (> 2 hours)
numTerms /= 2;
}
@ -66,7 +69,8 @@ public class TestBagOfPositions extends LuceneTestCase {
final ConcurrentLinkedQueue<String> postings = new ConcurrentLinkedQueue<String>(postingsList);
Directory dir = newFSDirectory(_TestUtil.getTempDir("bagofpositions"));
final RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
final RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc);
int threadCount = _TestUtil.nextInt(random(), 1, 5);
if (VERBOSE) {

View File

@ -25,6 +25,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.store.Directory;
@ -46,7 +47,9 @@ public class TestBagOfPostings extends LuceneTestCase {
boolean isSimpleText = "SimpleText".equals(_TestUtil.getPostingsFormat("field"));
if (isSimpleText && (TEST_NIGHTLY || RANDOM_MULTIPLIER > 1)) {
IndexWriterConfig iwc = newIndexWriterConfig(random(), TEST_VERSION_CURRENT, new MockAnalyzer(random()));
if ((isSimpleText || iwc.getMergePolicy() instanceof MockRandomMergePolicy) && (TEST_NIGHTLY || RANDOM_MULTIPLIER > 1)) {
// Otherwise test can take way too long (> 2 hours)
numTerms /= 2;
}
@ -67,7 +70,7 @@ public class TestBagOfPostings extends LuceneTestCase {
final ConcurrentLinkedQueue<String> postings = new ConcurrentLinkedQueue<String>(postingsList);
Directory dir = newFSDirectory(_TestUtil.getTempDir("bagofpostings"));
final RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
final RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc);
int threadCount = _TestUtil.nextInt(random(), 1, 5);
if (VERBOSE) {