lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan McKinley <ryan...@gmail.com>
Subject Re: implementing a random result request handler - solr 1.2
Date Mon, 07 Jul 2008 17:47:10 GMT
The random sort field in solr 1.3 relies on the field name and dynamic  
fields for ordering.  Check the example solrconfig.xml in 1.3

    <dynamicField name="random*" type="random" />

to get random results, try various field names:
  &sort=rand_123 asc
  &sort=rand_xyz asc
  &sort=rand_{generate your random number on the client} asc

This is good because you will get the same results for the same query  
string, and will get a new set of random results for a new URL.

ryan


On Jul 7, 2008, at 1:40 PM, Sean Laval wrote:
> The RandomSortField in 1.3.... each time you then issue a query, you  
> get the same random sort order right? That is to say the randomness  
> is implemented at index time rather than search time?
>
> Thanks,
>
> --------------------------------------------------
> From: "Yonik Seeley" <yonik@apache.org>
> Sent: Monday, July 07, 2008 6:22 PM
> To: <solr-user@lucene.apache.org>
> Subject: Re: implementing a random result request handler - solr 1.2
>
>> If it's just a random ordering you are looking for, it's implemented
>> in the latest Solr 1.3
>> Solr 1.3 should be out soon, so if you are just starting development,
>> I'd start with the latest Solr version.
>>
>> If you really need to stick with 1.2 (even after 1.3 is out?)  then
>> RandomSortField should be easy to backport to 1.2
>>
>> -Yonik
>>
>> On Mon, Jul 7, 2008 at 1:15 PM, Sean Laval <seanlaval@hotmail.com>  
>> wrote:
>>> Well its simply a business requirement from my perspective. I am  
>>> not sure I
>>> can say more than that. I could maybe implement a request handler  
>>> that did
>>> an initial search to work out how many hits there are resulting  
>>> from the
>>> query and then did as many more queries as were required fetching  
>>> just 1
>>> document starting at a given random number .. would that work?  
>>> Sounds a bit
>>> cludgy to me even as I say it.
>>>
>>> Sean
>>>
>>>
>>>
>>> --------------------------------------------------
>>> From: "Walter Underwood" <wunderwood@netflix.com>
>>> Sent: Monday, July 07, 2008 5:06 PM
>>> To: <solr-user@lucene.apache.org>
>>> Subject: Re: implementing a random result request handler - solr 1.2
>>>
>>>> Why do you want random hits? If we know more about the bigger
>>>> problem, we can probably make better suggestions.
>>>>
>>>> Fundamentally, Lucene is designed to quickly return the best
>>>> hits for a query. Returning random hits from the entire
>>>> matched set is likely to be very slow. It just isn't what
>>>> Lucene is designed to do.
>>>>
>>>> wunder
>>>>
>>>> On 7/7/08 8:58 AM, "Sean Laval" <seanlaval@hotmail.com> wrote:
>>>>
>>>>> I have seen various posts about implementing random sorting  
>>>>> relating to
>>>>> the
>>>>> 1.3 code base but I am trying to do this in 1.2. Does anyone  
>>>>> have any
>>>>> suggestions? The approach I have considered is to implement my own
>>>>> request
>>>>> handler that picks random documents from a larger result list. I
>>>>> therefore
>>>>> need to be able to create a DocList and add documents to it but  
>>>>> can't
>>>>> seem to
>>>>> do this. Does anyone have any advice they could offer please?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Sean
>>>>
>>>>
>>>


Mime
View raw message