: Suppose, I have 3 categories like politics, science and sports. In the : schema, I am defining a field type called 'Category'. I don't have a sub : category field type (and don't want to have one). Now, Cricket and : Football are some categories which can be considered to be under sports. : When I search for something and if it is present in the 'sports' : category, then it should show me the facets of cricket and football too.
: My question is: Do I need to specify cricket, football also as : categories or sub categories of sports (for which I don't want to make a : separate field)? And if I make these as categories only, then how will I : achieve the drilling down of the data to cricket or football. there are lots of solutions to problems like this, but picking the best one tends to depend on what exactly you wnat the search experience to be like. based on your description of your problem, an approach where you index all of the "ancestor breadcrumbs" for hte categories a document is in along with the "depth" of each ancestor in the tree, and then facet on those with a prefix restriction would probably work well. ie: docA: cat = sport/cricket docB: cat = sport/shateboarding docC: cat = sport/skateboarding/vert docD: cat = sport/skateboarding/street docE: cat = finance tokens indexed.... docA: cat = 0/sport, 1/sport/cricket docB: cat = 0/sport, 1/sport/shateboarding docC: cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/vert docD: cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/street docE: cat = 0/finance so now your first request you use something like... q=foobar&facet=true&facet.field=cat&f.cat.facet.prefix=0/ ..and you'll get facet counds for sport and finance. if they pick "sport" your next request is something like... q=foobarfq=cat:0/sport&facet=true&facet.field=cat&f.cat.facet.prefix=1/sport/ ...and you'll get facet counds for all the subcats of sport ... etc. -Hoss