Question

I have integrated Solr 4 for e-commerce application. And offers a facet filters like flipkart on category pages. Filters works fine, however, the facets has min count set to 1, so facets with zero count are not returned by Solr.

Now, I want to display those with zero count like displayed here in this image.

enter image description here

However, just like in this image, Screen Size can be present in other category as well, so in this case instead of displaying only those options presents for this category it displays all options which are no applicable for the this current category.

So, it lists all the facets as zero even if they have nothing to do with this category. My problem is I want to display only those facets which are available if there no filters applied and then display them greyed out when they are no longer applicable.

Any clue how to do this?

Was it helpful?

Solution

One thing you can try is getting the facets with and without the filter within the same query.
Check Multi-Select_Faceting_and_LocalParams

  1. Return the Same facet with and without exclusion
  2. If No filters they would be same.
  3. If filter applied, the Normal facet will have filtered Facets and exclusion facet will have facets without the filter. fq={!tag=dt}doctype:pdf&facet=on&facet.field={!ex=dt}doctype&facet.field=doctype
  4. Compare at Client side for the differences and display accordingly.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top