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

optimization: when sorting by field, if index has one segment and field values are not needed, do not load String[] into field cache

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • 4.9, 6.0
    • core/search
    • New

    Description

      Spinoff from java-dev thread "Sorting with little memory: A suggestion", started by Toke Eskildsen.

      When sorting by SortField.STRING we currently ask FieldCache for a StringIndex on that field.

      This can consumes tons of RAM, when the values are mostly unique (eg a title field), as it populates both int[] ords as well as String[] values.

      But, if the index is only one segment, and the search sets fillFields=false, we don't need the String[] values, just the int[] ords. If the app needs to show the fields it can pull them (for the 1 page) from stored fields.

      This can be a potent optimization – alot of RAM saved – for optimized indexes.

      When fixing this we must take care to share the int[] ords if some queries do fillFields=true and some =false... ie, FieldCache will be called twice and it should share the int[] ords across those invocations.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mikemccand Michael McCandless
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: