Hi,

According to http://yonik.com/solr-facet-functions/, we can sort on "any
facet function that appears in each bucket":

$ curl http://localhost:8983/solr/query -d 'q=*:*&
 json.facet={
   categories:{
     type : terms,
     field : cat,
     sort : "x desc",   // can also use sort:{x:desc}
     facet:{
       x : "avg(price)",
       y : "sum(price)"
     }
   }
 }
'

But is it possible to sort by a subfacet's value? Note that I'm not talking
about sorting each subfacet bucket's content, rather sorting the 'cat'
terms by its subfacet results... Example (this doesn't work but should show
my intent):

$ curl http://localhost:8983/solr/query -d 'q=*:*&
 json.facet={
   categories:{
     type : terms,
     field : cat,
     sort:{x.numBuckets:asc},
     facet:{
       x:{
         type:terms,
         field:subcat,
         numBuckets:true
       }
     }
   }
 }
'

Reply via email to