I have a similar solr scheme like this:
<doc>
<str name="count">5</str>
<arr name="tag_id">
<str>1</str>
<str>2</str>
</arr>
</doc>
<doc>
<str name="count">2</str>
<arr name="tag_id">
<str>2</str>
<str>3</str>
</arr>
</doc>
And as a result I am looking for the facets on tag_id combined with the sum of count like:
tag_id: sum
1: 5
2: 7
3: 2
Is there an easy solution with this? I stumpled upon function queries, but I am not sure if this is solvable with it.
Please check for Solr Pivots
Solr Pivot should be able to provide hierarchical facets, which you can use as facet.pivot = tag_id,count
.
You should get back results as
tag_id 1
count 5
tag id 2
count 2
count 5
tag id 3
count 2
You can do the count consolidation on the client side.