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

SegmentTermEnum.next() doesn't maintain prevBuffer at end

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 2.0.0
    • Fix Version/s: 2.3
    • Component/s: core/index
    • Labels:
      None
    • Environment:

      Lucene Trunk

      Description

      When you're iterating a SegmentTermEnum and you go past the end of the docs, you end up with a state where the nextBuffer = null and the prevBuffer is the penultimate term, not the last term. This patch fixes it. (It's also required for my Prefetching bug LUCENE-506)

      Index: java/org/apache/lucene/index/SegmentTermEnum.java
      ===================================================================
      — java/org/apache/lucene/index/SegmentTermEnum.java (revision 382121)
      +++ java/org/apache/lucene/index/SegmentTermEnum.java (working copy)
      @@ -109,6 +109,7 @@
      /** Increments the enumeration to the next element. True if one exists.*/
      public final boolean next() throws IOException {
      if (position++ >= size - 1)

      { + prevBuffer.set(termBuffer); termBuffer.reset(); return false; }

        Activity

        Hide
        mikemccand Michael McCandless added a comment -

        You're welcome! And sorry it took such a crazy long time...

        Show
        mikemccand Michael McCandless added a comment - You're welcome! And sorry it took such a crazy long time...
        Hide
        tamm Steven Tamm added a comment -

        Thanks!

        -Steven

        Show
        tamm Steven Tamm added a comment - Thanks! -Steven
        Hide
        mikemccand Michael McCandless added a comment -

        I just committed this. Thanks Steven!

        Show
        mikemccand Michael McCandless added a comment - I just committed this. Thanks Steven!
        Hide
        mikemccand Michael McCandless added a comment -

        I have a unit test showing this ... will commit fix shortly.

        Show
        mikemccand Michael McCandless added a comment - I have a unit test showing this ... will commit fix shortly.

          People

          • Assignee:
            mikemccand Michael McCandless
            Reporter:
            tamm Steven Tamm
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development