lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <>
Subject Re: Get results in multiple orders (multiple boosts)
Date Fri, 18 Aug 2017 08:58:08 GMT
On Fri, Aug 18, 2017 at 8:21 AM, Luca Dall'Osto
<> wrote:
> Yes, of course, and excuse me for the misunderstanding.
> In my scenario I have to display a list with hundreds of documents.
> An user can show this documents in a particular order, this order is decided by user
in a settings view.
> Order levels are for example:
> 1) Order by category, as most important.
> 2) Order by source, as second level.
> 3) Order by date (ascending or descending).
> 4) Order by title (ascending or descending).
> For category order, in settings view, user has an box with a list of all categories available
for him/her.
> User drag&drop elements of the list to set in the favorite order.
> Same thing for sources.

Solr can only sort by indexed fields, it needs to be able to compare
one document to another document, and the only information available
at that point are the indexed fields.

This would be untenable in your scenario, because you cannot add a
category.<userid>.sort_order field to every document for every user.

If this custom sorting is a hard requirement, the only feasible
solution I see is to write a custom sorting plugin, that provides a
function that you can sort on. This blog post describes how this can
be achieved:

I would imagine that you would need one sort function, maybe called
usersortorder(), to which you would provide the users preferred sort
ordering (which you would retrieve from wherever you store such
information) and the field that you want sorted. It would look
something like this:

usersortorder("category_id", "3,5,1,7,2,12,14,58") DESC,
usersortorder("source_id", "5,2,1,4,3") DESC, date DESC, title DESC



View raw message