3
votes

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:

  • Facet query does'nt help due to it introduce a list with the results, of the specific facet queries. (nor filter query does)

    2921

  • Facet.prefix does the kind of filter that i want, but i don't know how to use it in this scenario.

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>
1

1 Answers

5
votes

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