Solr multiple facet with ex and tag functions -
i using solr 4.10 , our requirement have multiple facets. each of facet should filter should impact selected facet, not other facets.
for example, lets there 2 facets brand , type. when user select brand nikon, should impact type facet, not brand facet. similar behavior type.
i tried implementing tag , ex function , query comes below,
/select?q=query&wt=json&start=0&rows=10&facet=true&fq={!tag=brand}brand:(canon,nikon)&fq={!tag=type}type:(tv)&facet.mincount=1&facet.field={!ex=brand}brand&facet.field={!ex=type}type&fl=id,brand,type
this works fine of cases, when there 0 results, somehow solr returns facets 1 of facet. above query, value in type, though there no documents in response.
below response get,
{ "response": { "numfound": 0, "start": 0, "docs": [] }, "facet_counts": { "facet_queries": {}, "facet_fields": { "type": [ "tv", 4 ], "brand": [] }, "facet_dates": {}, "facet_ranges": {}, "facet_intervals": {} }
}
Comments
Post a Comment