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

CLONE - ConjunctionSolrSpellChecker wrong check for same string distance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.9
    • 7.4
    • spellchecker
    • None

    Description

      See ConjunctionSolrSpellChecker.java

      try {
      if (stringDistance == null)

      { stringDistance = checker.getStringDistance(); }

      else if (stringDistance != checker.getStringDistance())

      { throw new IllegalArgumentException( "All checkers need to use the same StringDistance."); }

      } catch (UnsupportedOperationException uoe)

      { // ignore }

      In line stringDistance != checker.getStringDistance() there is comparing by references. So if you are using 2 or more spellcheckers with same distance algorithm, exception will be thrown anyway.

      Update: As of Solr 6.5, this has been changed to stringDistance.equals(checker.getStringDistance()) .
      However, LuceneLevenshteinDistance does not even override equals method.

      This does not solve the problem yet, because the default equals method anyway compares references.

      Hence unable to use FileBasedSolrSpellChecker .

      Moreover, Some check of similar sorts should also be in the init method. So that user does not have to wait for this error during query time. If the spellcheck components have been added solrconfig.xml , it should throw error during core-reload itself.

      Attachments

        1. SOLR-10513.patch
          2 kB
          Amrit Sarkar
        2. SOLR-10513.patch
          3 kB
          Amrit Sarkar
        3. SOLR-10513.patch
          4 kB
          Amrit Sarkar
        4. SOLR-10513.patch
          10 kB
          Amrit Sarkar
        5. SOLR-10513.patch
          12 kB
          Amrit Sarkar
        6. SOLR-10513.patch
          12 kB
          Amrit Sarkar
        7. SOLR-10513.patch
          5 kB
          James Dyer

        Issue Links

          Activity

            People

              jdyer James Dyer
              asingh2411 Abhishek Kumar Singh
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: