You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by NarasimhaRaju <ra...@yahoo.com> on 2010/06/01 10:45:57 UTC

Re: Interleaving the results

Can some body throw some ideas, on how to achieve (interleaving) from with in the application especially in a distributed setup?


 “ There are only 10 types of people in this world:-
Those who understand binary and those who don’t “ 


Regards, 
P.N.Raju,




________________________________
From: Lance Norskog <go...@gmail.com>
To: solr-user@lucene.apache.org
Sent: Sat, May 29, 2010 3:04:46 AM
Subject: Re: Interleaving the results

There is no interleaving tool. There is a random number tool. You will
have to achive this in your application.

On Fri, May 28, 2010 at 8:23 AM, NarasimhaRaju <ra...@yahoo.com> wrote:
> Hi,
> how to achieve custom ordering of the documents when there is a general query?
>
> Usecase:
> Interleave documents from different customers one after the other.
>
> Example:
> Say i have 10 documents in the index belonging to 3 customers (customer_id field in the index ) and using query *:*
> so all the documents in the results score the same.
> but i want the results to be interleaved
> one document from the each customer should appear before a document from the same customer repeats ?
>
> is there a way to achieve this ?
>
>
> Thanks in advance
>
> R.
>
>
>
>



-- 
Lance Norskog
goksron@gmail.com



      

Re: Interleaving the results

Posted by Geert-Jan Brits <gb...@gmail.com>.
Indeed, it's just a matter of ordening the results on the client-side IFF I
infer correctly from your description that you are guarenteed to get results
from enough different customers from SOlr in the first place to do the
interleaving that you describe. (In general this is a pretty big IF).

So assuming that's the case, you just make sure to return the customerid as
part of the solr-result (make sure the customerid is stored) (or get the
customerid through other means e.g: look it up in a db based on the id of
the doc returned).
Finally, simply code the interleaving (for example: throw the results in
something like Map<customerid, List<docid>> and iterate the map, so you get
the first element of each list then the 2nd, etc...



2010/6/1 NarasimhaRaju <ra...@yahoo.com>

> Can some body throw some ideas, on how to achieve (interleaving) from with
> in the application especially in a distributed setup?
>
>
>  “ There are only 10 types of people in this world:-
> Those who understand binary and those who don’t “
>
>
> Regards,
> P.N.Raju,
>
>
>
>
> ________________________________
> From: Lance Norskog <go...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Sat, May 29, 2010 3:04:46 AM
> Subject: Re: Interleaving the results
>
> There is no interleaving tool. There is a random number tool. You will
> have to achive this in your application.
>
> On Fri, May 28, 2010 at 8:23 AM, NarasimhaRaju <ra...@yahoo.com> wrote:
> > Hi,
> > how to achieve custom ordering of the documents when there is a general
> query?
> >
> > Usecase:
> > Interleave documents from different customers one after the other.
> >
> > Example:
> > Say i have 10 documents in the index belonging to 3 customers
> (customer_id field in the index ) and using query *:*
> > so all the documents in the results score the same.
> > but i want the results to be interleaved
> > one document from the each customer should appear before a document from
> the same customer repeats ?
> >
> > is there a way to achieve this ?
> >
> >
> > Thanks in advance
> >
> > R.
> >
> >
> >
> >
>
>
>
> --
> Lance Norskog
> goksron@gmail.com
>
>
>
>
>