Search code examples
solrgroupingfacet

Solr facet with sub facets


I'm trying to find a solution to make a subfacet list for some facets.

I have a clothes size on some products and they are stored in solr

"Size_both":"W30L30", "Size_width":"W30", "Size_length":"L30"

I wish to generate a list of subfacet for each width:

  1. W30 (8)

    • L30 (3)
    • L32 (1)
    • L33 (4)
  2. W32 (2)

    • L30 (1)
    • L34 (1)

etc

Anyone know how to accomplish this? I thought I could do this with group, but that didn't work.


Solution

  • Use Facet Pivoting to achieve desired result:

    Facet Pivoting

    Try Below Query:

    http://<host_name>:<port>/solr/<core_name>/select?q=*:*&rows=20&wt=json&indent=true&facet=true&facet.pivot=Size_width,Size_length