Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-1046

Dead code in SpellChecker.java (branch never executes)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: modules/spellchecker
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      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.

        Attachments

        1. LUCENE-1046.diff
          2 kB
          Daniel Naber

          Activity

            People

            • Assignee:
              otis Otis Gospodnetic
              Reporter:
              joe1111 Joe
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: