SOLR-3567: Spellcheck custom parameters not being passed through due to wrong prefix creation

This commit is contained in:
Shalin Shekhar Mangar 2018-05-23 11:12:39 +05:30
parent 0a730d4c1a
commit 9b1cb6646f
3 changed files with 7 additions and 4 deletions

View File

@ -230,6 +230,9 @@ Bug Fixes
* SOLR-12377: Don't spin off overseer when Zk controller is closed (Mikhail Khludnev)
* SOLR-3567: Spellcheck custom parameters not being passed through due to wrong prefix creation.
(Josh Lucas via shalin)
Optimizations
----------------------

View File

@ -339,10 +339,10 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
protected SolrParams getCustomParams(String dictionary, SolrParams params) {
ModifiableSolrParams result = new ModifiableSolrParams();
Iterator<String> iter = params.getParameterNamesIterator();
String prefix = SpellingParams.SPELLCHECK_PREFIX + "." + dictionary + ".";
while (iter.hasNext()){
String prefix = SpellingParams.SPELLCHECK_PREFIX + dictionary + ".";
while (iter.hasNext()) {
String nxt = iter.next();
if (nxt.startsWith(prefix)){
if (nxt.startsWith(prefix)) {
result.add(nxt.substring(prefix.length()), params.getParams(nxt));
}
}

View File

@ -160,7 +160,7 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 {
@Test
public void testPerDictionary() throws Exception {
assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_BUILD, "true", "q","documemt"
, SpellingParams.SPELLCHECK_DICT, "perDict", SpellingParams.SPELLCHECK_PREFIX + ".perDict.foo", "bar", SpellingParams.SPELLCHECK_PREFIX + ".perDict.bar", "foo")
, SpellingParams.SPELLCHECK_DICT, "perDict", SpellingParams.SPELLCHECK_PREFIX + "perDict.foo", "bar", SpellingParams.SPELLCHECK_PREFIX + "perDict.bar", "foo")
,"/spellcheck/suggestions/bar=={'numFound':1, 'startOffset':0, 'endOffset':1, 'suggestion':['foo']}"
,"/spellcheck/suggestions/foo=={'numFound':1, 'startOffset':2, 'endOffset':3, 'suggestion':['bar']}"
);