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 mtheone <mt...@gmail.com> on 2012/02/09 09:03:30 UTC

How to do this in Solr? random result for the first few results

Say I have a classified ads site, I want to display 2 random items (premium
ads) in the beginning of the search result and the rest are regular ads, how
do I do it? 

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-do-this-in-Solr-random-result-for-the-first-few-results-tp3728729p3728729.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to do this in Solr? random result for the first few results

Posted by Chris Hostetter <ho...@fucit.org>.
: ok i was looking at RandomSortField and got confused by "As long as the
: index version remains unchanged, and the same field name is reused, the
: ordering of the docs will be consistent. " So does that mean it's not really
: random if I'm hitting an index which doesn't have an update for a while?

it means that you get a consistent random ordering for each field against 
each version of the index.

if you want a completely new random ordering every time, use a new field 
name everytime (configured with a dynamic field)

"sort=random_1234 desc" will be a differnet random ordering then 
"sort=random_9876 desc" even if they index hasn't changed.


-Hoss

Re: How to do this in Solr? random result for the first few results

Posted by mtheone <mt...@gmail.com>.

ok i was looking at RandomSortField and got confused by "As long as the
index version remains unchanged, and the same field name is reused, the
ordering of the docs will be consistent. " So does that mean it's not really
random if I'm hitting an index which doesn't have an update for a while?

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-do-this-in-Solr-random-result-for-the-first-few-results-tp3728729p3731411.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to do this in Solr? random result for the first few results

Posted by mtheone <mt...@gmail.com>.
I'd rather boost premium ads rather than go the way of elevation.

@wunder

i think I'll go with your suggestion, thanks all

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-do-this-in-Solr-random-result-for-the-first-few-results-tp3728729p3731393.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to do this in Solr? random result for the first few results

Posted by Walter Underwood <wu...@wunderwood.org>.
Or you can do a search for two ads with random ordering, then a second search for ads in the desired order with excludes for the two ads returned in the first. 

You don't have to do everything inside Solr.

wunder
Search Guy, Chegg

On Feb 9, 2012, at 1:04 AM, Tommaso Teofili wrote:

> I think you may use/customize the query elevation component to achieve that.
> http://wiki.apache.org/solr/QueryElevationComponent
> Tommaso
> 
> 2012/2/9 mtheone <mt...@gmail.com>
> 
>> Say I have a classified ads site, I want to display 2 random items (premium
>> ads) in the beginning of the search result and the rest are regular ads,
>> how
>> do I do it?
>> 
>> Thanks
>> 
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/How-to-do-this-in-Solr-random-result-for-the-first-few-results-tp3728729p3728729.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>> 






Re: How to do this in Solr? random result for the first few results

Posted by Tommaso Teofili <to...@gmail.com>.
I think you may use/customize the query elevation component to achieve that.
http://wiki.apache.org/solr/QueryElevationComponent
Tommaso

2012/2/9 mtheone <mt...@gmail.com>

> Say I have a classified ads site, I want to display 2 random items (premium
> ads) in the beginning of the search result and the rest are regular ads,
> how
> do I do it?
>
> Thanks
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-do-this-in-Solr-random-result-for-the-first-few-results-tp3728729p3728729.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: How to do this in Solr? random result for the first few results

Posted by Ahmet Arslan <io...@yahoo.com>.
> Say I have a classified ads site, I
> want to display 2 random items (premium
> ads) in the beginning of the search result and the rest are
> regular ads, how
> do I do it? 

http://wiki.apache.org/solr/QueryElevationComponent is used for paid inclusion.