I have a document structure in Solr that looks something like this (irrelevant fields excluded):
<field name="review_id" type="int" indexed="true" stored="true"/>
<field name="product_id" type="int" indexed="true" stored="true"/>
<field name="product_category" type="string" indexed="true" stored="true" multiValued="true"/>
product_id here is one-to-many wrt review_id
I can get a faceted count of reviews in each category by doing:
/select?q=*:*&rows=0&facet=true&facet.field=product_category
I want to be able to do faceting on the product_category, but get the number of distinct product_id:s instead of the number of review_id:s. Is this possible to do in Solr?