Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-4304

Coupling between SpellCheckComponent(s) and QueryConverter(s) is a mess and makes no sense

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0
    • None
    • spellchecker
    • None

    Description

      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:

      <queryConverter name="myQueryConverter-1" class="solr.SpellingQueryConverter"/>
      <queryConverter name="myQueryConverter-2" class="solr.SuggestQueryConverter"/>
      

      2. Perform a spellcheck request:

      curl "http://localhost:8983/solr/spell?q=test&indent=true"

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jkrupan Jack Krupansky

            Dates

              Created:
              Updated:

              Slack

                Issue deployment