Specifically, what drives the position in the list?  Is it arbitrary or is
it driven by some piece of data?

If data-driven - code could do the sorting based on that data...  separate
from SOLR...

Alternatively, if the data point exists in SOLR, a "sub-query" might be
used to get the right sort order on the items returned by the "main"
search...  Possibly without having to resort to the clunky-feeling listpos
multivalued field...

On Fri, Apr 1, 2016 at 10:32 AM, Tamás Barta <bartata...@gmail.com> wrote:

> For example I have to display sellable products which are in list X in the
> correct order.
>
> If I add a "status" and "list" (multivalued) fields to every document
> (products), then I can execute a query: status:sellable AND list:X, where X
> is the ID of the list. The list field contains IDs of the list in which the
> product is in.
>
> The problem is that I can't sort the result. A product has different index
> for every list.
>
> Is it clear now?
>
> Earlier I added a "listpos" field with multivalue content, for example:
>
> 1:23
> 2:4
>
> Which means that this product is in position 23 in list 1 and it is in
> position 4 in list 2. After that I created a custom comparator which parses
> field values to get index for the specified list and sorts by that index.
>
> But I didn't like that solution much. I wish there would be a better
> solution. In SolrJ unfortunately I can't find an API to set custom
> comparator like I did in Lucene. So I don't know how to solve this problem
> in Solr.
>
> Thanks,
> Tamás
> 2016. ápr. 1. 17:25 ezt írta ("Alessandro Benedetti" <
> abenede...@apache.org
> >):
>
> > I think this is a classic XY Problem , you are trying to solve X with Y ,
> > and you are asking us about Y .
> > Could you describe us what is your X problem ? What are you trying to do
> > with this ordered lists ?
> >
> > If not I would add a field to the product called :
> > list_position ( or a similar name) of type geo point (x,y) .
> > X could be your list ID
> > Y the position.
> > Then you can play with spatial search, to get what you want.
> >
> > But again, let's try to solve X.
> >
> > Cheers
> >
>

Reply via email to