mirror of https://github.com/apache/lucene.git
test-only fixes: MockRandomCodec sometimes never picked an index term; TestNRTThreads creates way too many segments
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1125711 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
91c74bb6e7
commit
dbf5ab4af2
|
@ -196,7 +196,7 @@ public class MockRandomCodec extends Codec {
|
|||
|
||||
@Override
|
||||
public boolean isIndexTerm(BytesRef term, TermStats stats) {
|
||||
return rand.nextInt(gap) == 17;
|
||||
return rand.nextInt(gap) == gap/2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,6 +71,21 @@ public class TestNRTThreads extends LuceneTestCase {
|
|||
final File tempDir = _TestUtil.getTempDir("nrtopenfiles");
|
||||
final MockDirectoryWrapper dir = new MockDirectoryWrapper(random, FSDirectory.open(tempDir));
|
||||
final IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random));
|
||||
|
||||
if (LuceneTestCase.TEST_NIGHTLY) {
|
||||
// newIWConfig makes smallish max seg size, which
|
||||
// results in tons and tons of segments for this test
|
||||
// when run nightly:
|
||||
MergePolicy mp = conf.getMergePolicy();
|
||||
if (mp instanceof TieredMergePolicy) {
|
||||
((TieredMergePolicy) mp).setMaxMergedSegmentMB(5000.);
|
||||
} else if (mp instanceof LogByteSizeMergePolicy) {
|
||||
((LogByteSizeMergePolicy) mp).setMaxMergeMB(1000.);
|
||||
} else if (mp instanceof LogMergePolicy) {
|
||||
((LogMergePolicy) mp).setMaxMergeDocs(100000);
|
||||
}
|
||||
}
|
||||
|
||||
conf.setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
|
||||
@Override
|
||||
public void warm(IndexReader reader) throws IOException {
|
||||
|
|
Loading…
Reference in New Issue