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

Dead code in SpellChecker.java (branch never executes)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.2
    • None
    • modules/spellchecker
    • None
    • 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

            otis Otis Gospodnetic
            joe1111 Joe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: