Lucene - Core
  1. Lucene - Core
  2. LUCENE-2648

Allow PackedInts.ReaderIterator to advance more than one value

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0-ALPHA
    • Fix Version/s: 4.0-ALPHA
    • Component/s: core/other
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      The iterator-like API in LUCENE-2186 makes effective use of PackedInts.ReaderIterator but frequently skips multiple values. ReaderIterator currently requires to loop over ReaderInterator#next() to advance to a certain value. We should allow ReaderIterator to expose a #advance(ord) method to make use-cases like that more efficient.

      This issue is somewhat part of my efforts to make LUCENE-2186 smaller while breaking it up in little issues for parts which can be generally useful.

      1. LUCENE-2648.patch
        8 kB
        Simon Willnauer
      2. LUCENE-2648.patch
        7 kB
        Simon Willnauer

        Issue Links

          Activity

          Hide
          Simon Willnauer added a comment -

          here is a patch - comments welcome

          Show
          Simon Willnauer added a comment - here is a patch - comments welcome
          Hide
          Simon Willnauer added a comment -

          Since this API is new in 4.0 I wonder if we should then rename it to PackedIntsEnum or PackedIntsIterator since ReaderIterator is a very general term. Another option would be to just name it Iterator since it already has a name context because its an inner class.

          Show
          Simon Willnauer added a comment - Since this API is new in 4.0 I wonder if we should then rename it to PackedIntsEnum or PackedIntsIterator since ReaderIterator is a very general term. Another option would be to just name it Iterator since it already has a name context because its an inner class.
          Hide
          Michael McCandless added a comment -

          Looks good Simon!

          Maybe instead of

          public int docID()

          we should name it

          public int ord()

          ? Ie, the index is not always a docID (eg when the fixed-gap terms index uses packed ints, it's the term ord).

          Show
          Michael McCandless added a comment - Looks good Simon! Maybe instead of public int docID() we should name it public int ord() ? Ie, the index is not always a docID (eg when the fixed-gap terms index uses packed ints, it's the term ord).
          Hide
          Simon Willnauer added a comment -

          ? Ie, the index is not always a docID (eg when the fixed-gap terms index uses packed ints, it's the term ord).

          Ah good point - I will fix.

          Show
          Simon Willnauer added a comment - ? Ie, the index is not always a docID (eg when the fixed-gap terms index uses packed ints, it's the term ord). Ah good point - I will fix.
          Hide
          Simon Willnauer added a comment -

          changed ReaderIterator#docId() to ReaderIterator#ord()

          Show
          Simon Willnauer added a comment - changed ReaderIterator#docId() to ReaderIterator#ord()
          Hide
          Simon Willnauer added a comment -

          I will commit tomorrow if nobody objects

          Show
          Simon Willnauer added a comment - I will commit tomorrow if nobody objects
          Hide
          Simon Willnauer added a comment -

          committed in rev. 998445

          Show
          Simon Willnauer added a comment - committed in rev. 998445

            People

            • Assignee:
              Simon Willnauer
              Reporter:
              Simon Willnauer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development