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

Hoss Man commented on SOLR-264:
-------------------------------

i was kind of wondering about the negative overflow (isn't that underflow) but 
i was trusting you that it worked ... isn't there still a potential problem 
with the transitive property if  i.doc + seed causes positive integer overflow?

(i guess it's okay because the overflow is the same regardless of whether it's 
i or j, but in the previous case the overflow happend *after*the hash call.

FWIW: i still think newComparator should be something like...

        public ScoreDocComparator newComparator(IndexReader reader, String 
fieldname) throws IOException {
          return new RandomComparator(seed ^ reader.getVersion());
        }

...so that people who want orderings that are randomized per each <commit/> can 
just use...

  <field name="random" type="random" />

With the attachment as is, most changes to the index (ie: add a few documents, 
delete a few documents) won't have a significant impact on the "random" order 
because they won't change the majority of the docIds... you have to change the 
"seed" to see any noticable effects.

> 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, RandomSortField.java, 
> RandomSortField.java, 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