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

LuceneDictionary skips first word in enumeration

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.2
    • Component/s: core/other
    • Labels:
      None
    • Environment:

      Windows Sun JRE 1.4.2_10_b03

    • Lucene Fields:
      New

      Description

      The current code for LuceneDictionary will always skip the first word of the TermEnum. The reason is that it doesn't initially retrieve TermEnum.term - its first call is to TermEnum.next, which moves it past the first term (line 76).
      To see this problem cause a failure, add this test to TestSpellChecker:
      similar = spellChecker.suggestSimilar("eihgt",2);
      assertEquals(1, similar.length);
      assertEquals(similar[0], "eight");

      Because "eight" is the first word in the index, it will fail.

        Attachments

        1. TestLuceneDictionary.java
          7 kB
          Christian Mallwitz
        2. LuceneDictionary.java
          3 kB
          Christian Mallwitz

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dtertman Dan Ertman
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: