I'm trying to get a two-level facet count from our solr server. The documents look like this (shortened to only the relevant fields):
{
"id":"100071F5",
"datasource":"ABC",
"mediatype":"ISSBD"
}
With a query like this ...
http://localhost:8983/solr/select?wt=json&fl=id&indent=true&facet=true&facet.field=datasource&facet.field=mediatype
... I get as a result like this:
"facet_fields":{
"datasource":[
"ABC",75286,
"DEF",47257],
"mediatype":[
"POSTCARD",75286,
"RARE",12033,
"MANUSCRIPT",9418,
"BOOK",5849,
"OTHER",4747,
"UNKNOWN",2603,
"MAP",1033,
"GLOBE",704,
"MIXED",13,
"ISSUE",1]} ...
But what I really want is something like this:
"facet_fields":{
"datasource":[
"ABC",75286,
"mediatype":[
"POSTCARD",1234,
"RARE",1,
"BOOK",533,
"OTHER",47],
"DEF",47257,
"mediatype":[
"POSTCARD",7286,
"RARE",1203,
"MANUSCRIPT",918,
"BOOK",549,
"OTHER",4747,
"UNKNOWN",2603,
"MAP",1033,
"GLOBE",704,
"MIXED",13,
"ISSUE",1]} ...
In words: I like to have a facet over one field and then a subfacet for each subresult over another field. Is this possible in Solr?