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

Optimizations to TopScoreDocCollector and TopFieldCollector

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      This is a spin-off of LUCENE-1575 and proposes to optimize TSDC and TFC code to remove unnecessary checks. The plan is:

      1. Ensure that IndexSearcher returns segements in increasing doc Id order, instead of numDocs().
      2. Change TSDC and TFC's code to not use the doc id as a tie breaker. New docs will always have larger ids and therefore cannot compete.
      3. Pre-populate HitQueue with sentinel values in TSDC (score = Float.NEG_INF) and remove the check if reusableSD == null.
      4. Also move to use "changing top" and then call adjustTop(), in case we update the queue.
      5. some methods in Sort explicitly add SortField.FIELD_DOC as a "tie breaker" for the last SortField. But, doing so should not be necessary (since we already break ties by docID), and is in fact less efficient (once the above optimization is in).
      6. Investigate PQ - can we deprecate insert() and have only insertWithOverflow()? Add a addDummyObjects method which will populate the queue without "arranging" it, just store the objects in the array (this can be used to pre-populate sentinel values)?

      I will post a patch as well as some perf measurements as soon as I have them.

        Attachments

        1. LUCENE-1593.patch
          61 kB
          Shai Erera
        2. PerfTest.java
          4 kB
          Shai Erera
        3. LUCENE-1593.patch
          109 kB
          Shai Erera
        4. LUCENE-1593.patch
          101 kB
          Shai Erera
        5. LUCENE-1593.patch
          101 kB
          Shai Erera
        6. LUCENE-1593.patch
          92 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              shaie Shai Erera
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: