I have a set of documents similar to parent child relation, except that they are not indexed as nested - they are denormalized. below are the set of records
id,parent_id,,author
1,0,a1
2,1,a2
3,1,a3
4,1,a4
5,0,a5
6,5,a6
7,5,a7
8,0,a8
9,8,a9
10,0,a10
The above records with id 1,5,8,10 are parent records(parent_id=0) and others are child(their parent_id value is their parent)
My solr query should facet based on parent_id for child records, use that pivot parent_id and match it with id to get the author of parent
Need to combine below two queries into one
query 1: fq=-parent_id:0&facet=true;facet.pivot=parent_id
From above query if get three parent ids as result of faceting - 1,5,8,10
query 2: fl=author&fq=parent_id IN {1,5,8,10}
Finally output should be a1,a5,a8,a10 - Ideally I need top author which is a1 as they have 4 children
I tried local parameters option, faceting etc. But not able to find way to combine the output of facet query, and use it in another query - all in one go.
Restrictions are - not able to nest documents to use block join. Any help would be greatly appreciated. Thank you