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
This commit is contained in:
Grant Ingersoll 2008-06-30 18:03:23 +00:00
parent bc21016abd
commit 1fb3859f7c
4 changed files with 21 additions and 32 deletions

View File

@ -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

View File

@ -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>

View File

@ -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) {

View File

@ -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>