From e745742505ef920f0edfc2bdbeec6980a19e3272 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Mon, 23 Nov 2009 16:12:12 +0000 Subject: [PATCH] SOLR-1580: Solr Configuration ignores 'mergeFactor' parameter, always uses Lucene default. git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@883388 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ src/java/org/apache/solr/update/SolrIndexWriter.java | 3 ++- src/test/org/apache/solr/BasicFunctionalityTest.java | 6 ++++++ src/test/test-files/solr/conf/solrconfig.xml | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) 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