lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Svånå <david.sv...@gmail.com>
Subject Json facet sort by subfacet
Date Tue, 25 Jul 2017 13:48:21 GMT
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
       }
     }
   }
 }
'

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message