You want to use descendent_path. If you have a delimiter of /, then: books/it/programming/java
would become: books books/IT books/IT/programming books/IT/programming/java Meaning you can facet on this field. If you wish to get a specific level only, then you need to either do your own splitting, or extend the PathHierarchyTokenizerFactory to be able to do it like this: 1:books 2:books/IT 3:books/IT/programming 4:books/IT/programming/java Then, you can use facet.prefix to search for a specific level in the hierarchy. Fixing the PathHierarchyTokenizer would be great for all of us. Upayavira On Sat, Nov 9, 2013, at 03:19 PM, Nea wrote: > HierarchicalFaceting documentation does not clearly explain how to index > and query field types "descendent_path and ancestor_path” included in > schema.xml. > > Any help would be greatly appreciated. > > > <!-- > Example of using PathHierarchyTokenizerFactory at index time, so > queries for paths match documents at that path, or in descendent > paths > —> > > <fieldType name="descendent_path" class="solr.TextField"> > <analyzer type="index"> > <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" /> > </analyzer> > <analyzer type="query"> > <tokenizer class="solr.KeywordTokenizerFactory" /> > </analyzer> > </fieldType> > > <!-- > Example of using PathHierarchyTokenizerFactory at query time, so > queries for paths match documents at that path, or in ancestor > paths > —> > > <fieldType name="ancestor_path" class="solr.TextField"> > <analyzer type="index"> > <tokenizer class="solr.KeywordTokenizerFactory" /> > </analyzer> > <analyzer type="query"> > <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" /> > </analyzer> > </fieldType> > > > On Nov 9, 2013, at 15:22, Upayavira <u...@odoko.co.uk> wrote: > > > http://wiki.apache.org/solr/HierarchicalFaceting > > > > Upayavira > > > > On Sat, Nov 9, 2013, at 12:09 PM, Nea wrote: > >> Hi Everybody, > >> > >> I’m using Solr 4.5.1 and I need to achieve a HierarchicalFaceting for > >> leveled categories. Someone can explain me how schema.xml and query > >> should be? > >> > >> > >> My category path is; > >> > >> Cameras > Camcorders [ > >> 5 items] > >> Cameras > Digital Cameras > >> Cameras > Digital Cameras > Digital SLR [15 items] > >> Cameras > Digital Cameras > Mirrorless Cameras [ 4 items] > >> > >> > >> And i want to facet as; > >> > >> first query: > >> cameras (24) > >> > >> second level query > >> camorders (5) > >> digital cameras (19) > >> > >> third level facet query for digital cameras > >> digital slr (15) > >> mirrorless (4) > >> > >> > >> ty. > >> > >> >