Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
4.0
-
None
-
None
Description
The SpellCheckComponent doesn't do any significant validation of whether its input list of spellcheckers is malformed.
For example:
<searchComponent name="spellcheckBug" class="solr.SpellCheckComponent"> <str name="name">other-name</str> <str name="classname">solr.FileBasedSpellChecker</str> <str name="sourceLocation">SpellDict.txt</str> </searchComponent>
Oops, I forgot to put the "lst" element in there, like:
<searchComponent name="spellcheckBug" class="solr.SpellCheckComponent"> <lst name="spellchecker"> <str name="name">other-name</str> <str name="classname">solr.FileBasedSpellChecker</str> <str name="sourceLocation">SpellDict.txt</str> </lst> </searchComponent>
But, there was no complaint from Solr.
The code:
for (int i = 0; i < initParams.size(); i++) { if (initParams.getName(i).equals("spellchecker")) { } }
No else.
There is one other param that could be present, "queryAnalyzerFieldType", but any other param name should throw an exception.
The handler I used:
<requestHandler name="/spellBug" class="solr.SearchHandler" startup="lazy"> <lst name="defaults"> <str name="df">name</str> <str name="spellcheck">on</str> <str name="spellcheck.dictionary">some-name</str> </lst> <arr name="last-components"> <str>spellcheckBug</str> </arr> </requestHandler>
And the query request:
curl "http://localhost:8983/solr/spellBug?q=catl&indent=true"
In this case, the query returned without doing any spellchecking, when an error would be more appropriate.