I have a book database. Books have genre ids as integers, and also age ranges in integers age_min and age_max.
When I make a query, I'd like to know 1) a list of distinct genre ids that are in the result and 2) any of those results are between different 1 or more age ranges (0-4, 5-7, etc.).
I'd like a list of genre_ids as well as how many books are for ages 0-4, 5-7, 7-10, and so on.
I can use facet.field for the genre_ids and that works fine, but I cannot figure out to have that in addition to the different age ranges.
My query for JUST genre_id facet looks like this:
So, not only tell me the genre_ids that make up the results but also how many of those books are ages 0-4, 5-7, etc..
Something like:
"facet_fields":{
"genre_id":{
"38":998,
"638":915,
"ages":{
"0-4":4,
"5-7":10,
and so forth.
Is there a way to get all this information from one solr query?