[ 
https://issues.apache.org/jira/browse/LUCENE-9326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17116928#comment-17116928
 ] 

Tony Xu commented on LUCENE-9326:
---------------------------------

Hi Alan,

I landed here because of this PR 
[https://github.com/apache/lucene-solr/pull/1537/files]

It reminds me an issue[1] that I reported while working on our in-house 
application that manages sorting ourselves. This means we want to only read the 
values. However, reading the values of a SortField needs to go through 
FieldComparator which in most of the cases maintain a priority queue (allocate 
storage). 

 

Maybe this is not directly relevant to what you're trying to solve but linking 
it here for awareness.

[1]https://issues.apache.org/jira/browse/LUCENE-8878

> Refactor SortField to better handle extensions
> ----------------------------------------------
>
>                 Key: LUCENE-9326
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9326
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Alan Woodward
>            Assignee: Alan Woodward
>            Priority: Major
>
> 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to