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:
us...@infra.apache.org



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

Reply via email to