move flush policy default into IWC, matching other configs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1151187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-07-26 17:51:06 +00:00
parent 6edb2422f7
commit 25477c33ba
3 changed files with 4 additions and 7 deletions

View File

@ -134,12 +134,8 @@ final class DocumentsWriter {
this.perThreadPool = config.getIndexerThreadPool();
this.chain = config.getIndexingChain();
this.perThreadPool.initialize(this, globalFieldNumbers, config);
final FlushPolicy configuredPolicy = config.getFlushPolicy();
if (configuredPolicy == null) {
flushPolicy = new FlushByRamOrCountsPolicy();
} else {
flushPolicy = configuredPolicy;
}
flushPolicy = config.getFlushPolicy();
assert flushPolicy != null;
flushPolicy.init(this);
flushControl = new DocumentsWriterFlushControl(this, config);
}

View File

@ -164,6 +164,7 @@ public final class IndexWriterConfig implements Cloneable {
} else {
mergePolicy = new LogByteSizeMergePolicy();
}
flushPolicy = new FlushByRamOrCountsPolicy();
readerPooling = DEFAULT_READER_POOLING;
indexerThreadPool = new ThreadAffinityDocumentsWriterThreadPool();
readerTermsIndexDivisor = DEFAULT_READER_TERMS_INDEX_DIVISOR;

View File

@ -69,7 +69,7 @@ public class TestIndexWriterConfig extends LuceneTestCase {
assertEquals(IndexWriterConfig.DEFAULT_READER_TERMS_INDEX_DIVISOR, conf.getReaderTermsIndexDivisor());
assertEquals(TieredMergePolicy.class, conf.getMergePolicy().getClass());
assertEquals(ThreadAffinityDocumentsWriterThreadPool.class, conf.getIndexerThreadPool().getClass());
assertNull(conf.getFlushPolicy());
assertEquals(FlushByRamOrCountsPolicy.class, conf.getFlushPolicy().getClass());
assertEquals(IndexWriterConfig.DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB, conf.getRAMPerThreadHardLimitMB());
// Sanity check - validate that all getters are covered.
Set<String> getters = new HashSet<String>();