[jira] Created: (SOLR-264) Support 'random' sort order

classic Classic list List threaded Threaded
34 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
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


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 | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)

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

Ryan McKinley updated SOLR-264:
-------------------------------

    Attachment: SOLR-264-RandomSortOrder.patch

Implements a 'ScoreDocComparator' that returns a random number.

I don't know if this is a fair distribution, but the results look ok.

This is the meat:

static final ScoreDocComparator RANDOM = new ScoreDocComparator() {
    final Random rand = new Random();
   
    public int compare (ScoreDoc i, ScoreDoc j) {
      return sortValue(i).compareTo( sortValue(j) );
    }
    public Comparable sortValue (ScoreDoc i) {
      return new Float(rand.nextFloat());
    }
    public int sortType() {
      return SortField.CUSTOM;
    }
  };

- - - - -

One thing that is wierd is that it seems to need a valid field name.  Solr sets up sorting with a field cache, so I just pick any field name (by default the unique key) and use that.  Any reason this is a bad idea?

- - - -

Old discussion on this topic:
http://www.nabble.com/random-order-tf3198916.html#a8881481


> 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
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

Rather than mess with query parsing to hack in support for a "random" key word, a more elegant way would be to create a RandomFieldType specifically for sorting, then hook it in via the schema in the normal manner.

Since this is such a unique requirement (probably not broadly applicable), one might want to make this as a custom component in a QueryComponent chain that we discussed recently.
http://www.nabble.com/search-components-%28plugins%29-tf3898040.html#a11050274

> 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
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

>
> Rather than mess with query parsing to hack in support for a "random" key word, a more elegant way would be to create a RandomFieldType specifically for sorting, then hook it in via the schema in the normal manner.
>

That sounds good -- then you don't run the risk of namespace overlap.  The special keyword 'score' already makes me a bit nervous.  It seems like you could make a field named score, but could not sort by it and could not refer to it (except as *)

 
> Since this is such a unique requirement (probably not broadly applicable)

Is it so unique?  In 'full text search' sure, but if the domain is 'database' it seems pretty fundamental.  I can't be the only person who wants to do:

 SELECT * FROM features ORDER BY rand();

 fq=feature:true&sort=random

> 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
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

Ryan McKinley updated SOLR-264:
-------------------------------

    Attachment: SOLR-264-RandomSortOrder.patch

Random sorting implemented as a FieldType.

to enable random sorting, you need to add something like:

  <fieldType name="random" class="solr.RandomSortField" />
  <field name="random" type="random" indexed="true" stored="false"/>

to schema.xml

> 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
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

nextFloat() generates a random int and then does a floating point divide (one of the slowest operations around).
Instead, use
  return rand.nextBoolean() ? -1 : 1;
Or a branch-free version:
  return rand.nextInt() >>> 31;


> 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
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

Ryan McKinley updated SOLR-264:
-------------------------------

    Attachment: SOLR-264-RandomSortOrder.patch

using:
  rand.nextBoolean() ? -1 : 1;

the fancy pants >>> returns a distribution 0,1  -- to get a reasonable random sort, it needs to be 1 or -1

> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

> the fancy pants >>> returns a distribution 0,1 -- to get a reasonable random sort, it needs to be 1 or -1

Hmmm, so
  (rand.nextInt() & 0x2) - 1


> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

Uhh, guys ... this code violates the contract of Comparator (which is admittedly not an explicit part of the of ScoreDocComparator contract, but it is implied) because:

  1) the method isn't stable ... compare(x,y) is not garunteed to have the same sign as a subsequent compare(x,y)  
  2) it doesn't guarantee that the sign of compare(x,y) is the negation of the sign of compare(y,x)
  3) it doesn't guarantee a transitive property ... if ((compare(x, y)>0) && (compare(y, z)>0))  then: compare(x, z)>0.



> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

Yeah, I briefly thought of that... but decided it might be OK (won't cause an infinite loop) since sorting is done via a priority queue.

But thinking on this further, it still has a lot of problems besides a single query:
 - caching... oops, there goes your randomness
 - code that needs to query more than once (first pass gets "n" docs, then requests more)


> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

    [ 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

Hold up a minute... I have a better way... gotta run to a meeting thoughj

> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

the only clean way to do this that i know of i to build aFieldCache-esque rray of size maxDoc, put a random number of each doc into that array, and then use that array to get the sortValue ... document order is randomized, but consistent for all uses of the same array (if you leverage the FieldCache custom type, that means its' consistent per IndexReader)

this was brought up recently on java-user, after i suggested an alternative approach of just promoting N randomly selected docs to the front of the results (where N is greater then your expected pagination...

http://www.nabble.com/Several-questions-about-scoring-sorting-%2B-random-sorting-in-an-image-related-application-tf3928435.html#a11141191


> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

Yonik Seeley updated SOLR-264:
------------------------------

    Attachment: RandomSortField.java

> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

    [ 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

Of course this could also implement a ValueSource if someone really wanted to throw randomness into scoring...

> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

wow.

why is it whenever i read a patch from yonik that starts with a bunch of bitshift operators, i start to worry that in 7 days a weird girl is going to climb out of a well and then i'm going to die?

that's some freaky shit ... but i can't see anything wrong with the approach.  (assuming the hash function does what it says it does)

in general, any approach that uses a fixed seed per SortComparatorSource should work, and getting the seed from the "filed name" seems like a slick way to do it ... we wouldn't even have to require that the field name match any sort of pattern (ie: end with _ and a number) we could just hash on the field name.

people could even choose to use a regular field (instead of a dynamic field) and accept that they'd get a fixed ordering per commit/> if we also used the IndexReader version in computing the seed.

> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

Yonik Seeley updated SOLR-264:
------------------------------

    Attachment: RandomSortField.java

Just for the fun of it, added prototype (read: completely untested) ValueSource.

> 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, 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-264) Support 'random' sort order

Chris Mattmann (Jira)
In reply to this post by Chris Mattmann (Jira)

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

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

> we wouldn't even have to require that the field name match any sort of pattern (ie: end with _ and a number) we could just hash on the field name.

Excellent point.  I had considered adding the hash of the prefix to the field value... but  just hashing over the complete name and not requiring a specific format is much better.

You'll have to let me know the reference to the girl and the well stuff sometime ;-)

> 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, 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 | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (SOLR-264) Support 'random' sort order

Chris Hostetter-3

: You'll have to let me know the reference to the girl and the well stuff sometime ;-)

http://imdb.com/title/tt0298130/plotsummary
http://www.youtube.com/watch?v=IlhZCDlEmh0


-Hoss

12