Not the OP, but this is /much/ simpler, although at the expense of
making 2 calls to solr. But the upside is that no customization is
required.

On Thu, 2011-09-22 at 09:43 +0100, Doug McKenzie wrote:
> Could you not just do your normal search with and add a filter query on? 
> fq=topoffer:true
> 
> That would then return only results with top offer : true and then use 
> whatever shuffling / randomising you like in your application. 
> Alternately you could even add sorting on relevance to show the top 5 
> closest matches to the query rows=5&sort=score desc
> 
> 
> 
> On 21/09/2011 21:26, Sujit Pal wrote:
> > Hi MOuli,
> >
> > AFAIK (and I don't know that much about Solr), this feature does not
> > exist out of the box in Solr. One way to achieve this could be to
> > construct a DocSet with topoffer:true and intersect it with your result
> > DocSet, then select the first 5 off the intersection, randomly shuffle
> > them, sublist [0:5], and move the sublist to the top of the results like
> > QueryElevationComponent does. Actually you may want to take a look at
> > QueryElevationComponent code for inspiration (this is where I would have
> > looked if I had to implement something similar).
> >
> > -sujit
> >
> > On Wed, 2011-09-21 at 06:54 -0700, MOuli wrote:
> >> Hey Community.
> >>
> >> I got a Lucene/Solr Index with many offers. Some of them are marked by a
> >> flag field "topoffer" that they are top offers. Now I want so sort randomly
> >> 5 of this offers on the top.
> >>
> >> For Example
> >> HTC Sensation
> >>   - topoffer = true
> >> HTC Desire
> >>   - topoffer = false
> >> Samsung Galaxy S2
> >>   - topoffer = ture
> >> IPhone 4
> >>   - topoffer = true
> >> ...
> >>
> >> When i search for a Handy then i want that first 3 offers are HTC 
> >> Sensation,
> >> Samsung Galaxy S2 and the iPhone 4.
> >>
> >>
> >> Does anyone have an idea?
> >>
> >> PS.: I hope my english is not to bad
> >>
> >> --
> >> View this message in context: 
> >> http://lucene.472066.n3.nabble.com/Sort-five-random-Top-Offers-to-the-top-tp3355469p3355469.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> --
> Become a Firebox Fan on Facebook: http://facebook.com/firebox
> And Follow us on Twitter: http://twitter.com/firebox
> 
> Firebox has been nominated for Retailer of the Year in the 2011 Stuff Awards. 
> Who will win? It's up to you! Visit http://www.stuff.tv/awards and place your 
> vote. We'll do a special dance if it's us.
> 
> Firebox HQ is MOVING HOUSE! We're migrating from Streatham Hill to  shiny new 
> digs in Shoreditch. As of 3rd October please update your records to:
> Firebox.com, 6.10 The Tea Building, 56 Shoreditch High Street, London, E1 6JJ
> 
> Global Head Office: Firebox House, Ardwell Road, London SW2 4RT
> Firebox.com Ltd is registered in England and Wales, company number 3874477
> Registered Company Address: 41 Welbeck Street London W1G 8EA Firebox.com
>  
> Any views expressed in this email are those of the individual sender, except 
> where the sender expressly, and with authority, states them to be the views 
> of Firebox.com Ltd.

Reply via email to