You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Mikołaj Kania (JIRA)" <ji...@apache.org> on 2015/03/19 10:07:38 UTC

[jira] [Comment Edited] (SOLR-6271) ConjunctionSolrSpellChecker wrong check for same string distance

    [ https://issues.apache.org/jira/browse/SOLR-6271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14366989#comment-14366989 ] 

Mikołaj Kania edited comment on SOLR-6271 at 3/19/15 9:06 AM:
--------------------------------------------------------------

This is especially a problem when you want to use DirectSolrSpellChecker with FileBasedSpellChecker. What make things interesting is that WordBreakSpellChecker works fine beacuse its getStringDistance() method throws UnsupportedOperationException, and in ConjunctionSolrSpellChecker there is that work-around for this:

{code}
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
    }
{code}


was (Author: mikolajkania):
This is especially a problem when you want to use DirectSolrSpellChecker with FileBasedSpellChecker. What make things interesting is that WordBreakSpellChecker works fine beacuse its getStringDistance() method throws UnsupportedOperationException, and in ConjunctionSolrSpellChecker there is that pretty smelly work-around for this:

{code}
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
    }
{code}

> ConjunctionSolrSpellChecker wrong check for same string distance
> ----------------------------------------------------------------
>
>                 Key: SOLR-6271
>                 URL: https://issues.apache.org/jira/browse/SOLR-6271
>             Project: Solr
>          Issue Type: Bug
>          Components: spellchecker
>    Affects Versions: 4.9
>            Reporter: Igor Kostromin
>         Attachments: SOLR-6271.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org