Apache Lucene open-source search software
Rollback SOLR-609 in favor of getting the defaults from ReqHandler. Change around the config to demonstrate, also updated on the Wiki.
Grant Ingersoll1fb3859f7c24
diff --git a/CHANGES.txt b/CHANGES.txtindex fe57edba68d..60232aa0455 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -446,7 +446,6 @@ Bug Fixes37. SOLR-604: If the spellchecking path is relative, make it relative to the Solr Data Directory. (Shalin Shekhar Mangar via gsingers)-38. SOLR-609: SpellCheckComponent now honors defaults. (Shalin Shekhar Mangar via gsingers)Other Changes1. SOLR-135: Moved common classes to org.apache.solr.common and altered thediff --git a/example/solr/conf/solrconfig.xml b/example/solr/conf/solrconfig.xmlindex ad2981f9c8a..c913badb01b 100755--- a/example/solr/conf/solrconfig.xml+++ b/example/solr/conf/solrconfig.xml@@ -491,14 +491,7 @@<searchComponent name="spellcheck" class="org.apache.solr.handler.component.SpellCheckComponent">- <lst name="defaults">- <!-- omp = Only More Popular -->- <str name="spellcheck.onlyMorePopular">false</str>- <!-- exr = Extended Results -->- <str name="spellcheck.extendedResults">false</str>- <!-- The number of suggestions to return -->- <str name="spellcheck.count">1</str>- </lst>+<str name="queryAnalyzerFieldType">textSpell</str><lst name="spellchecker">@@ -528,6 +521,14 @@<queryConverter name="queryConverter" class="org.apache.solr.spelling.SpellingQueryConverter"/><requestHandler name="/spellCheckCompRH" class="org.apache.solr.handler.component.SearchHandler">+ <lst name="defaults">+ <!-- omp = Only More Popular -->+ <str name="spellcheck.onlyMorePopular">false</str>+ <!-- exr = Extended Results -->+ <str name="spellcheck.extendedResults">false</str>+ <!-- The number of suggestions to return -->+ <str name="spellcheck.count">1</str>+ </lst><arr name="last-components"><str>spellcheck</str></arr>diff --git a/src/java/org/apache/solr/handler/component/SpellCheckComponent.java b/src/java/org/apache/solr/handler/component/SpellCheckComponent.javaindex 4d1c36f2425..fc4eac466eb 100644--- a/src/java/org/apache/solr/handler/component/SpellCheckComponent.java+++ b/src/java/org/apache/solr/handler/component/SpellCheckComponent.java@@ -136,8 +136,6 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar@SuppressWarnings("unchecked")protected NamedList initParams;- @SuppressWarnings("unchecked")- protected SolrParams defaults;/*** Key is the dictionary, value is the SpellChecker for that dictionary name@@ -151,12 +149,6 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwarpublic void init(NamedList args) {super.init(args);this.initParams = args;- if (args != null) {- Object o = args.get("defaults");- if (o != null && o instanceof NamedList) {- defaults = SolrParams.toSolrParams((NamedList)o);- }- }}@Override@@ -196,17 +188,14 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar}if (tokens != null && tokens.isEmpty() == false) {if (spellChecker != null) {- int count = params.getInt(SPELLCHECK_COUNT, defaults.getInt(- SPELLCHECK_COUNT, 1));+ int count = params.getInt(SPELLCHECK_COUNT, 1);boolean onlyMorePopular = params.getBool(SPELLCHECK_ONLY_MORE_POPULAR,- defaults.getBool(SPELLCHECK_ONLY_MORE_POPULAR,- DEFAULT_ONLY_MORE_POPULAR));+ DEFAULT_ONLY_MORE_POPULAR);boolean extendedResults = params.getBool(SPELLCHECK_EXTENDED_RESULTS,- defaults.getBool(SPELLCHECK_EXTENDED_RESULTS, false));+ false);NamedList response = new SimpleOrderedMap();IndexReader reader = rb.req.getSearcher().getReader();- boolean collate = params.getBool(SPELLCHECK_COLLATE, defaults.getBool(- SPELLCHECK_COLLATE, false));+ boolean collate = params.getBool(SPELLCHECK_COLLATE, false);SpellingResult spellingResult = spellChecker.getSuggestions(tokens,reader, count, onlyMorePopular, extendedResults);if (spellingResult != null) {diff --git a/src/test/test-files/solr/conf/solrconfig.xml b/src/test/test-files/solr/conf/solrconfig.xmlindex 248450c9d8b..ab712b44187 100644--- a/src/test/test-files/solr/conf/solrconfig.xml+++ b/src/test/test-files/solr/conf/solrconfig.xml@@ -318,14 +318,6 @@</requestHandler><searchComponent name="spellcheck" class="org.apache.solr.handler.component.SpellCheckComponent">- <lst name="defaults">- <!-- omp = Only More Popular -->- <str name="spellcheck.onlyMorePopular">false</str>- <!-- exr = Extended Results -->- <str name="spellcheck.extendedResults">false</str>- <!-- The number of suggestions to return -->- <str name="spellcheck.count">1</str>- </lst><str name="queryAnalyzerFieldType">lowerfilt</str><lst name="spellchecker">@@ -357,6 +349,14 @@<queryConverter name="queryConverter" class="org.apache.solr.spelling.SpellingQueryConverter"/><requestHandler name="spellCheckCompRH" class="org.apache.solr.handler.component.SearchHandler">+ <lst name="defaults">+ <!-- omp = Only More Popular -->+ <str name="spellcheck.onlyMorePopular">false</str>+ <!-- exr = Extended Results -->+ <str name="spellcheck.extendedResults">false</str>+ <!-- The number of suggestions to return -->+ <str name="spellcheck.count">1</str>+ </lst><arr name="last-components"><str>spellcheck</str></arr>