If a doc is listed as Book>Fiction>Sci-FI, it must be searchable when your facet query is "Book", "Book>Fiction", "Book>Fiction>Sci-fi".
I searched the Internet and the methods I came up with are:
1 Split the "Book>Fiction>Sci-FI" into "Book", "Book>Fiction", "Book>Fiction>Sci-fi" at index-time itself and store them in same field.
2 Have separate fields cat, sub_cat, sub_sub_cat. Split the catogories into corresponding fields and use Pivot facets http://wiki.apache.org/solr/SimpleFacetParameters#Pivot_.28ie_Decision_Tree.29_Faceting
What are other ways to do hierarchial facets, so that they can support any complex queries?
Faceted search is the dynamic clustering of items or search results into categories that let users drill into search results (or even skip searching entirely) by any value in any field. Each facet displayed also shows the number of hits within the search that match that category.
SOLR-6329) Pivot Faceting (whether distributed or not) only supports faceting on field values (SOLR-6353) Distributed Pivot Faceting may not work well with some custom FieldTypes. ( SOLR-6330) Using facet.* parameters as local params inside of facet.field causes problems in distributed search. (
Check http://wiki.apache.org/solr/HierarchicalFaceting
Its mentioned the options mentioned by you and some more.
Pivot facets is the solution for hierarchy faceting if you can use Solr 4.0
If you have issues upgrading, you can check the option @ http://www.lucidimagination.com/why-lucid/webinars/mastering-power-faceted-search (similar to option 1 of yours)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With