Affects Version/s: 4.0
Fix Version/s: None
The initial report here (from Jack Krupansky) was that if you configured multiple <queryConvertor> instances you would get an NPE because the SpellCheckComponent's inform() method assumes there will be at most 1.
Looking into this more deeply, it's actually just a surface symptom of a much more significant problem...
- QueryConverters can be configured as "first order" type plugins in solrconfig.xml using the <queryConverter> syntax, with the ability to have multiple instances each with their own names
- QueryConvertors don't seem to actually be instantiated/initialized unless there is a SpellCheckComponent – but if there are more then one SpellCheckComponent instances, then the QueryConverters will all be initialzed again and again.
- SpellCheckComponent expects there to be 0 or 1 QueryConvertors, throwing an NPE if multiple QueryConvertors are configured – there is no spellcheck request param to request a QueryConvertor by name.
- even if we tried to add a request param to pick a QueryConvertor by name – the SpellCheckComponent has a "queryAnalyzerFieldType" init param that is used to get an Analyzer which is passed to QueryConverter.setAnalyzer() on init – making it impossible to use multiple QueryConverter's with a single SpellCheckComponent, or a single (custom) QueryConvertor with multiple SpellCheckComponents with differnet queryAnalyzerFieldType init params
- NOTE: if 0 QueryConverters are configured then each SpellCheckComponent creates it's own private instance of "SpellingQueryConverter" – so there is no serious problem in this (default) situation with the SpellCheckComponent's being configured to use different queryAnalyzerFieldTypes
Initial steps reported to reproduce the NPE...
1. Add to 4.0 example solrconfig.xml:
2. Perform a spellcheck request: