[ 
https://issues.apache.org/jira/browse/SOLR-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506309
 ] 

Yonik Seeley commented on SOLR-264:
-----------------------------------

I just attached a draft approach (completely untested, uncommented, etc)

The approach would be to use a dynamic field random_* and then pass the seed 
for the random function in the field name.  So q=foo&sort=rand_165623

The docids are hashed, including the seed, to get random (but repeatable) 
values.
This should satisfy repeatability, cacheability, and sanity (can repeat a 
sequence if desired).
Since the SortComparatorSource isn't a singleton in this case, I implemented 
hashCode + equals for the queryCache.

> Support 'random' sort order
> ---------------------------
>
>                 Key: SOLR-264
>                 URL: https://issues.apache.org/jira/browse/SOLR-264
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>            Priority: Minor
>         Attachments: RandomSortField.java, SOLR-264-RandomSortOrder.patch, 
> SOLR-264-RandomSortOrder.patch, SOLR-264-RandomSortOrder.patch
>
>
> Support querying for random documents:
>   http://localhost:8983/solr/select/?q=*:*&fl=sku&sort=random%20desc

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to