You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Grant Ingersoll (JIRA)" <ji...@apache.org> on 2008/05/24 16:47:56 UTC

[jira] Commented: (LUCENE-1046) Dead code in SpellChecker.java (branch never executes)

    [ https://issues.apache.org/jira/browse/LUCENE-1046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12599602#action_12599602 ] 

Grant Ingersoll commented on LUCENE-1046:
-----------------------------------------

Note, this patch has the effect of changing output from the spell checker.  I think the new behavior is correct, just letting people know that they will now get the original word back for this case, where they did not before.

> Dead code in SpellChecker.java (branch never executes)
> ------------------------------------------------------
>
>                 Key: LUCENE-1046
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1046
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: contrib/spellchecker
>    Affects Versions: 2.2
>            Reporter: Joe
>            Assignee: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-1046.diff
>
>
> SpellChecker contains the following lines of code:
>     final int goalFreq = (morePopular && ir != null) ? ir.docFreq(new Term(field, word)) : 0;
>     // if the word exists in the real index and we don't care for word frequency, return the word itself
>     if (!morePopular && goalFreq > 0) {
>       return new String[] { word };
>     }
> The branch will never execute: the only way for goalFreq to be greater than zero is if morePopular is true, but if morePopular is true, the expression in the if statement evaluates to false.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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