You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:50:14 UTC

[GitHub] [lucene-solr] romseygeek commented on pull request #1537: LUCENE-9381: Add SortOrder interface

romseygeek commented on pull request #1537:
URL: https://github.com/apache/lucene-solr/pull/1537#issuecomment-634034654


   I should explain more clearly what I'm trying to do here :)
   
   `SortField` as currently constituted is a weird mix of concrete implementations and abstractions.  We have a set of implementations for the various numeric types, plus a keyword index based sort, score, and doc id, which are selected for via a SortType enum.  But this isn't extensible, so then we have an extra 'custom' type which anything that doesn't fit into these categories should use.  We also define everything as being based on a field (hence the name, plus `getField()`), but some sorts are based on multiple fields, or on something else entirely - score and doc return `null` from `getField()`, for example, or sorts based on expressions return the unparsed expression string.  So `SortField` needs an overhaul.  But, it's also used a lot in client code, and I wanted to keep a measure of backwards compatibility here.
   
   My idea was to add this `SortOrder` abstraction, and then convert everything that currently uses a SortField.CUSTOM implementation to instead just return a plain SortOrder.  For the remaining SortField types, I think it would be worth looking instead returning specialised SortOrders from factory methods on NumericDocValuesField, SortedDocValuesField, SortedSetDocValuesField, etc.  SortField stays, but is deprecated, so clients currently building sorts by directly instantiating a SortField get pointed towards these new factory methods.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org