0

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?

Krunal
  • 2,967
  • 8
  • 45
  • 101

1 Answers1

3

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.
Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • Thank you buddy for hint! I reviewed it. I get some idea but still not clear on Solr Query part, do you mean to specify same facet two times but how? – Krunal Sep 05 '13 at 06:10
  • yes you can specify the same facet twice as updated in example. – Jayendra Sep 05 '13 at 06:16
  • Thank you for your update. I will try with this and update you. BTW, Can you also give me some hint on setting custom order? http://stackoverflow.com/questions/18576517/set-custom-order-for-facets-coming-from-solr – Krunal Sep 05 '13 at 06:19
  • I have tried this today with Solr query but it doesn't list any filter with zero count. It still applies the constrain and offers only those facets which could be possible even after excluding it. Do we need to do a filter query to get the count? But that will change the product list, isn't it? Can you give me some hint with more than one facet filters. As for single facet this would work and offer with exclude but with many filters I see the same count in both the facets available from Solr. Pls advise. – Krunal Sep 05 '13 at 13:29
  • any clue on how to proceed with this? – Krunal Sep 12 '13 at 05:59