[ 
https://issues.apache.org/jira/browse/LUCENE-763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500521
 ] 

Steven Parkes commented on LUCENE-763:
--------------------------------------

Can we also update the javadocs to reflect the different semantics between 
terms() and terms(term)? Here's some possible verbage. (Also tweaks the "after 
the given term" which I think isn't correct?) 

{noformat} 
Index: src/java/org/apache/lucene/index/IndexReader.java
===================================================================
--- src/java/org/apache/lucene/index/IndexReader.java   (revision 543284)
+++ src/java/org/apache/lucene/index/IndexReader.java   (working copy)
@@ -539,16 +539,21 @@
     setNorm(doc, field, Similarity.encodeNorm(value));
   }
 
-  /** Returns an enumeration of all the terms in the index.
-   * The enumeration is ordered by Term.compareTo().  Each term
-   * is greater than all that precede it in the enumeration.
+  /** Returns an enumeration of all the terms in the index.  The
+   * enumeration is ordered by Term.compareTo().  Each term is greater
+   * than all that precede it in the enumeration.  Note that after
+   * calling [EMAIL PROTECTED] #terms()}, [EMAIL PROTECTED] TermEnum#next()} 
must be called
+   * on the resulting enumeration before calling other methods such as
+   * [EMAIL PROTECTED] TermEnum#term()}.
    * @throws IOException if there is a low-level IO error
    */
   public abstract TermEnum terms() throws IOException;
 
-  /** Returns an enumeration of all terms after a given term.
-   * The enumeration is ordered by Term.compareTo().  Each term
-   * is greater than all that precede it in the enumeration.
+  /** Returns an enumeration of all terms starting at a given term. If
+   * the given term does not exist, the enumeration is positioned a the
+   * first term greater than the supplied therm.  The enumeration is
+   * ordered by Term.compareTo().  Each term is greater than all that
+   * precede it in the enumeration.
    * @throws IOException if there is a low-level IO error
    */
   public abstract TermEnum terms(Term t) throws IOException;
{noformat} 


> LuceneDictionary skips first word in enumeration
> ------------------------------------------------
>
>                 Key: LUCENE-763
>                 URL: https://issues.apache.org/jira/browse/LUCENE-763
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.0.0
>         Environment: Windows Sun JRE 1.4.2_10_b03
>            Reporter: Dan Ertman
>             Fix For: 2.2
>
>         Attachments: LuceneDictionary.java, TestLuceneDictionary.java
>
>
> 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.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to