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

Refactor SortField to better handle extensions

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • New

    Description

      Working on LUCENE-9325 has made me realize that SortField needs some serious reworking:

      • we have a bunch of hard-coded types, but also a number of custom extensions, which make implementing new sort orders complicated in non-obvious ways
      • we refer to these hard-coded types in a number of places, in particular in index sorts, which means that you can't use a 'custom' sort here. For example, I can see it would be very useful to be able to index sort by distance from a particular point, but that's not currently possible.
      • the API separates out the comparator and whether or not it should be reversed, which adds an extra layer of complication to its use, particularly in cases where we have multiple sortfields.

      The whole thing could do with an overhaul. I think this can be broken up into a few stages by adding a new superclass abstraction which `SortField` will extend, and gradually moving functionality into this superclass. I plan on starting with index sorting, which will require a sort field to a) be able to merge sort documents coming from a list of readers, and b) serialize itself to and deserialize itself from SegmentInfo

      Attachments

        Activity

          People

            romseygeek Alan Woodward
            romseygeek Alan Woodward
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3.5h
                3.5h