If you add a filter query to your original query :
fq=genre:A
You know that your results ( group heads included) will just be of that
genre.
So I think we are not getting your question properly.
Can you try to express your requirement from the beginning.
Leave outside grouping or field collapsing
Thanks Alessandro for your suggestion.
I tried few queries around results collapsing but I am not able to get the
required result.
What I want is just to get representing document from any grouped result
based on certain field.
E.g. There are results which belong to genre A/B/C/D and each grouped
Can results collapsing[1] be of use for you ?
if it is the case, you can use that feature and explore its flexibility in
selecting the group head :
1) min | max for a numeric field
2) min | max for a function query
3) sort
[1]
https://lucene.apache.org/solr/guide/6_6/collapse-and-expand-results.h