diff --git a/CHANGES.txt b/CHANGES.txt index c16988179f6..301d73eff00 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -73,6 +73,9 @@ Bug Fixes * SOLR-1584: SolrJ - SolrQuery.setIncludeScore() incorrectly added fl=score to the parameter list instead of appending score to the existing field list. (yonik) + +* SOLR-1580: Solr Configuration ignores 'mergeFactor' parameter, always + uses Lucene default. (Lance Norskog via Mark Miller) * SOLR-1593: ReverseWildcardFilter didn't work for surrogate pairs (i.e. code points outside of the BMP), resulting in incorrect diff --git a/src/java/org/apache/solr/update/SolrIndexWriter.java b/src/java/org/apache/solr/update/SolrIndexWriter.java index 26f4bc006c9..f39eecf7c20 100644 --- a/src/java/org/apache/solr/update/SolrIndexWriter.java +++ b/src/java/org/apache/solr/update/SolrIndexWriter.java @@ -86,8 +86,9 @@ public class SolrIndexWriter extends IndexWriter { if (getMergePolicy() instanceof LogMergePolicy) { setUseCompoundFile(config.useCompoundFile); + if (config.mergeFactor != -1) { setMergeFactor(config.mergeFactor); } } else { - log.warn("Use of compound file format cannot be configured if merge policy is not an instance " + + log.warn("Use of compound file format or mergefactor cannot be configured if merge policy is not an instance " + "of LogMergePolicy. The configured policy's defaults will be used."); } diff --git a/src/test/org/apache/solr/BasicFunctionalityTest.java b/src/test/org/apache/solr/BasicFunctionalityTest.java index c1a0317b081..35a60416055 100644 --- a/src/test/org/apache/solr/BasicFunctionalityTest.java +++ b/src/test/org/apache/solr/BasicFunctionalityTest.java @@ -30,6 +30,7 @@ import org.apache.solr.core.SolrCore; import org.apache.solr.search.*; import org.apache.solr.handler.*; import org.apache.solr.request.*; +import org.apache.solr.update.SolrIndexWriter; import org.apache.solr.util.*; import org.apache.solr.schema.*; @@ -112,6 +113,11 @@ public class BasicFunctionalityTest extends AbstractSolrTestCase { } public void testSomeStuff() throws Exception { + // test merge factor picked up + SolrCore core = h.getCore(); + SolrIndexWriter writer = new SolrIndexWriter("testWriter",core.getNewIndexDir(), core.getDirectoryFactory(), false, core.getSchema(), core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy()); + assertEquals("Mergefactor was not picked up", writer.getMergeFactor(), 8); + lrf.args.put("version","2.0"); assertQ("test query on empty index", req("qlkciyopsbgzyvkylsjhchghjrdf") diff --git a/src/test/test-files/solr/conf/solrconfig.xml b/src/test/test-files/solr/conf/solrconfig.xml index 290a84f1d6d..d25e0422805 100644 --- a/src/test/test-files/solr/conf/solrconfig.xml +++ b/src/test/test-files/solr/conf/solrconfig.xml @@ -102,7 +102,7 @@ false - 10 + 8