Lici
Lici

Reputation: 998

Filtering solr facet counts

Given the following scenario:

<field name="product_id" type="text" indexed="true" stored="true" multivalued="true"/>
<field name="product_type" type="text" indexed="true" stored="true" multivalued="true"/>

i want to get facet counts for the facet field product_id filtered by specific product_type given a resultset (to get this i use filter query etc ...)

Note that what i want is to filter facet counts so:

Remark that i want to filter counting off productID that matches specific category

<lst name="facet_fields">
    <lst name="productID">
        <int name="xHidyhuVZIUVVMfUJM8zd6">209</int>
        <int name="34YFQf0F9kqP29SQgrmqI1">206</int>
        <int name="m3wp9GS9Iweai0ftKLSlG">195</int>
        <int name="aAwN5QFjQLxcrDWFiirjY2">169</int>
        <int name="k405yG1RwRndI5T19dMO8">169</int>
    </lst>
</lst>

Upvotes: 3

Views: 3489

Answers (1)

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99750

As far as I know you can't filter a facet count using another field. facet.prefix only operates on the same field that you're faceting.

I would issue another query that filters the product type, just to get the facet count you want, something like: select?q=product_type:somecategory&rows=0&facet=true&facet.field=product_id

Upvotes: 5

Related Questions