Hmmm, just specifying &sort= is _almost_ what you want,
except it sorts by the value of fields in the doc not numFound.

this shouldn't be hard to do on the client though, but you'd
have to return all the groups...

FWIW,
Erick

On Tue, Sep 24, 2013 at 1:11 PM, Brent Ryan <brent.r...@gmail.com> wrote:
> We ran into 1 snag during development with SOLR and I thought I'd run it by
> anyone to see if they had any slick ways to solve this issue.
>
> Basically, we're performing a SOLR query with grouping and want to be able
> to sort by the number of documents found within each group.
>
> Our query response from SOLR looks something like this:
>
> {
>
>   "responseHeader":{
>
>     "status":0,
>
>     "QTime":17,
>
>     "params":{
>
>       "indent":"true",
>
>       "q":"*:*",
>
>       "group.limit":"0",
>
>       "group.field":"rfp_stub",
>
>       "group":"true",
>
>       "wt":"json",
>
>       "rows":"10000000"}},
>
>   "grouped":{
>
>     "rfp_stub":{
>
>       "matches":18470,
>
>       "groups":[{
>
>
> "groupValue":"java.util.UUID:a1871c9e-cd7f-4e87-971d-d8a44effc33e",
>
>           "doclist":{"*numFound*":3,"start":0,"docs":[]
>
>           }},
>
>         {
>
>
> "groupValue":"java.util.UUID:0c2f1045-a32d-4a4d-9143-e09db45a20ce",
>
>           "doclist":{"*numFound*":5,"start":0,"docs":[]
>
>           }},
>
>         {
>
>
> "groupValue":"java.util.UUID:a3e1d56b-4172-4594-87c2-8895c5e5f131",
>
>           "doclist":{"*numFound*":6,"start":0,"docs":[]
>
>           }},
>
> …
>
>
> The *numFound* shows the number of documents within that group.  Is there
> anyway to perform a sort on *numFound* in SOLR ?  I don't believe this is
> supported, but wondered if anyone their has come across this and if there
> was any suggested workarounds given that the dataset is really too large to
> hold in memory on our app servers?

Reply via email to