From 1fb3859f7c2448630de0c64cbfae5f6431e493c5 Mon Sep 17 00:00:00 2001 From: Grant Ingersoll Date: Mon, 30 Jun 2008 18:03:23 +0000 Subject: [PATCH] Rollback SOLR-609 in favor of getting the defaults from ReqHandler. Change around the config to demonstrate, also updated on the Wiki. git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@672852 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 - example/solr/conf/solrconfig.xml | 17 +++++++++-------- .../component/SpellCheckComponent.java | 19 ++++--------------- src/test/test-files/solr/conf/solrconfig.xml | 16 ++++++++-------- 4 files changed, 21 insertions(+), 32 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index fe57edba68d..60232aa0455 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -446,7 +446,6 @@ Bug Fixes 37. 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 Changes 1. SOLR-135: Moved common classes to org.apache.solr.common and altered the diff --git a/example/solr/conf/solrconfig.xml b/example/solr/conf/solrconfig.xml index ad2981f9c8a..c913badb01b 100755 --- a/example/solr/conf/solrconfig.xml +++ b/example/solr/conf/solrconfig.xml @@ -491,14 +491,7 @@ - - - false - - false - - 1 - + textSpell @@ -528,6 +521,14 @@ + + + false + + false + + 1 + spellcheck diff --git a/src/java/org/apache/solr/handler/component/SpellCheckComponent.java b/src/java/org/apache/solr/handler/component/SpellCheckComponent.java index 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 SolrCoreAwar public 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.xml index 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 @@ - - - false - - false - - 1 - lowerfilt @@ -357,6 +349,14 @@ + + + false + + false + + 1 + spellcheck