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

Uwe Schindler commented on LUCENE-9330:
---------------------------------------

Hi,

I checked your PR. The first thing that I really did not like was that you 
serialize the class name of the Sortfield into the index. IMHO there should be 
SPI used for that in the same way like postingsformats.

My idea would be to make SortField abstract and let it implement NamedSPI (like 
codecs) and then add SortField.forName(). By this the index format gets 
independent

This also helps with Java's module system (see other issue), because when 
adding modules you have the problem that you can't load classes easily from 
different modules. This only works with SPI, your custom SortField 
implementation just need to be exported as service provider by your code.

Maybe not misuse SortField for all that stuff and instead have some new class 
that is just another codec component like PostingsFormat, responsible for 
Sorting. This one can also return a sort field instance used for search.

> Make SortField responsible for index sorting
> --------------------------------------------
>
>                 Key: LUCENE-9330
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9330
>             Project: Lucene - Core
>          Issue Type: Sub-task
>            Reporter: Alan Woodward
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Index sorting is currently handled inside Sorter and MultiSorter, with 
> hard-coded implementations dependent on SortField types.  This means that you 
> can't sort by custom SortFields, and also that the logic for handling 
> specific sort types is split between several unrelated classes.
> SortFields should instead be able to implement their own index sorting 
> methods.



--
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