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

DirectPostingsFormat can minimize binary searching in seek's

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • core/codecs
    • None
    • New

    Description

      I was looking at the DirectPostingsFormat to see exactly what it's doing when you I seekExact(). It does a plain binary search every time, even if I've positioned the state well into size of the array. A comment (probably left by mikemccand) shows that he too knows this could be done smarter:

              // TODO: we should use the skip pointers; should be
              // faster than bin search; we should also hold
              // & reuse current state so seeking forwards is
              // faster
      

      This issue represents resolving that TODO so it's isn't forgotten.

      For inspiration about solving this in a smarter way, see Solr's SortedIntDocSet which avoids binary search using an approach that could be borrowed for this codec.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dsmiley David Smiley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: