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

Add a way to disable the sort optimizations to leverage points on numeric fields

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 9.0, 8.10
    • None
    • None
    • New

    Description

      jimczi romseygeek mayya and I were just looking at a case when it would be useful to be able to disable the sort optimization.

      Say you have a 8.x index that has a field that is indexed with IntPoint and NumericDocValuesField. This field is used for index sorting, and the SortField is created with SortField.Type.LONG.

      This was accepted in 8.x, but this is something that Lucene 9 would complain about: since the field is an integer, it should use SortField.Type.Int, not SortField.Type.LONG. If the field was not used for index sorting, then you could just switch to SortField.Type.INT and everything would work fine.

      However since the field is used for index sorting, if you switch to SortField.Type.INT, then index-time SortField objects are going to compare differently from search-time SortField objects, which in-turn will disable early termination of queries in TopFieldCollector.

      To be able to migrate from indices that fall in this scenario, it would be helpful to have an option that would disable the optimization to use points as well as the associated validation logic, similarly to what we do in 8.x to enable this optimization.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jpountz Adrien Grand
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 50m
                2h 50m