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

Ryan McKinley commented on SOLR-264:
------------------------------------

Dooh.  I was worried about this at first, but it did not seem to matter.  
Perhaps my dataset isn't big enough to get itself stuck in a keep sorting 
loop...  

Do you see any holes in:  

private static class RandomScoreDocComparator implements ScoreDocComparator {
    final long start = System.currentTimeMillis();
    
    public int compare (ScoreDoc i, ScoreDoc j) {
      int vI = new Random(start+i.doc).nextInt();
      int vJ = new Random(start+j.doc).nextInt();
      return vI - vJ;
    }
    public Comparable sortValue (ScoreDoc i) {
      return new Integer(new Random(start+i.doc).nextInt());
    }
    public int sortType() {
      return SortField.CUSTOM;
    }
  };


> 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: 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