[ 
https://issues.apache.org/jira/browse/SOLR-10513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Abhishek Kumar Singh updated SOLR-10513:
----------------------------------------
    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.  


  was:
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.


> CLONE - ConjunctionSolrSpellChecker wrong check for same string distance
> ------------------------------------------------------------------------
>
>                 Key: SOLR-10513
>                 URL: https://issues.apache.org/jira/browse/SOLR-10513
>             Project: Solr
>          Issue Type: Bug
>          Components: spellchecker
>    Affects Versions: 4.9
>            Reporter: Abhishek Kumar Singh
>            Assignee: James Dyer
>             Fix For: 5.5
>
>
> 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.  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to