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

Decide on whether the central class of the sorting API should be a sorter or a comparator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • None
    • modules/other
    • None
    • New

    Description

      Robert made a good point on LUCENE-5312 that the API currently feels half baked since it exposes Sorter as a central point of the API while all the useful impls are based on a comparator.

      Initially, I wanted a Sorter to be the central class because it would allow to compute a DocMap eg. to revert the order of the documents in the index without having to actually sort the documents. If you look at Sorter.REVERSE_DOCS, it returns the DocMap that reverts index order in constant time.

      However, this Sorter-based API doesn't allow for composability although a comparator-based API could. For example, we would like to be able to compose a sorter for block joins based on a sorter for parents and another for children.

      So maybe the use-cases that are not based on an actual sort are not really important and we could enforce sorting so that sorters could be composable?

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: