From 309347e5b9f0238af2ffa09929fbf0e847a89436 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Tue, 29 Sep 2009 12:01:05 +0000 Subject: [PATCH] SOLR-1470 -- useCompoundFile was not taking effect git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@819891 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/solr/update/SolrIndexWriter.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/solr/update/SolrIndexWriter.java b/src/java/org/apache/solr/update/SolrIndexWriter.java index 6fee45fdc00..9271ac3245c 100644 --- a/src/java/org/apache/solr/update/SolrIndexWriter.java +++ b/src/java/org/apache/solr/update/SolrIndexWriter.java @@ -23,7 +23,6 @@ import org.apache.solr.common.SolrException; import org.apache.solr.common.util.NamedList; import org.apache.solr.core.DirectoryFactory; import org.apache.solr.core.StandardDirectoryFactory; -import org.apache.solr.core.SolrCore; import org.apache.solr.schema.IndexSchema; import org.apache.solr.util.SolrPluginUtils; @@ -35,7 +34,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; -import java.lang.reflect.InvocationTargetException; import java.text.DateFormat; import java.util.Date; @@ -63,7 +61,6 @@ public class SolrIndexWriter extends IndexWriter { // setUseCompoundFile(false); if (config != null) { - setUseCompoundFile(config.useCompoundFile); //only set maxBufferedDocs if (config.maxBufferedDocs != -1) { setMaxBufferedDocs(config.maxBufferedDocs); @@ -86,6 +83,14 @@ public class SolrIndexWriter extends IndexWriter { } if(config.mergePolicyInfo != null) SolrPluginUtils.invokeSetters(policy,config.mergePolicyInfo.initArgs); setMergePolicy(policy); + + if (getMergePolicy() instanceof LogMergePolicy) { + setUseCompoundFile(config.useCompoundFile); + } else { + log.warn("Use of compound file format cannot be configured if merge policy is not an instance " + + "of LogMergePolicy. The configured policy's defaults will be used."); + } + className = config.mergeSchedulerInfo == null ? SolrIndexConfig.DEFAULT_MERGE_SCHEDULER_CLASSNAME: config.mergeSchedulerInfo.className; MergeScheduler scheduler = (MergeScheduler) schema.getResourceLoader().newInstance(className); if(config.mergeSchedulerInfo != null) SolrPluginUtils.invokeSetters(scheduler,config.mergeSchedulerInfo.initArgs);