mirror of https://github.com/apache/lucene.git
SOLR-3567: Spellcheck custom parameters not being passed through due to wrong prefix creation
This commit is contained in:
parent
0a730d4c1a
commit
9b1cb6646f
|
@ -230,6 +230,9 @@ Bug Fixes
|
||||||
|
|
||||||
* SOLR-12377: Don't spin off overseer when Zk controller is closed (Mikhail Khludnev)
|
* 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
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -339,10 +339,10 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
|
||||||
protected SolrParams getCustomParams(String dictionary, SolrParams params) {
|
protected SolrParams getCustomParams(String dictionary, SolrParams params) {
|
||||||
ModifiableSolrParams result = new ModifiableSolrParams();
|
ModifiableSolrParams result = new ModifiableSolrParams();
|
||||||
Iterator<String> iter = params.getParameterNamesIterator();
|
Iterator<String> iter = params.getParameterNamesIterator();
|
||||||
String prefix = SpellingParams.SPELLCHECK_PREFIX + "." + dictionary + ".";
|
String prefix = SpellingParams.SPELLCHECK_PREFIX + dictionary + ".";
|
||||||
while (iter.hasNext()){
|
while (iter.hasNext()) {
|
||||||
String nxt = iter.next();
|
String nxt = iter.next();
|
||||||
if (nxt.startsWith(prefix)){
|
if (nxt.startsWith(prefix)) {
|
||||||
result.add(nxt.substring(prefix.length()), params.getParams(nxt));
|
result.add(nxt.substring(prefix.length()), params.getParams(nxt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testPerDictionary() throws Exception {
|
public void testPerDictionary() throws Exception {
|
||||||
assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_BUILD, "true", "q","documemt"
|
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/bar=={'numFound':1, 'startOffset':0, 'endOffset':1, 'suggestion':['foo']}"
|
||||||
,"/spellcheck/suggestions/foo=={'numFound':1, 'startOffset':2, 'endOffset':3, 'suggestion':['bar']}"
|
,"/spellcheck/suggestions/foo=={'numFound':1, 'startOffset':2, 'endOffset':3, 'suggestion':['bar']}"
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue