Hi,

I'm using the PathHierarchyTokenizer like this:

    <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>

 to create path based facets.

A query like:

http://localhost:8982/solr/articles/select?facet=true&start=0&q=*:*&facet.field=my_path_based_facet&wt=ruby&indent=on

gives facets that look like:

'my_path_based_facet'=>[
        'root',4,
        'root/books',4,
        'root/books/scifi',4,
        'root/books/scifi/fantasy',3,
        'root/books/scifi/fantasy/general',3,
        'root/books/scifi/horror',1,
        'root/books/scifi/horror/gore',1,
        'root/books/scifi/superhero',1,
        'root/books/scifi/superhero/superman',1,
        'root/books/scifi/superhero/superman/general',1]}

What I'm wondering if if there is an easy way for me to say I only want up
to level 2 say. So if root was level 0, the returned facets would be:

        'root',4,
        'root/books',4,
        'root/books/scifi',4,


Also given my the description of what I want to achieve is using
PathHierachyTokenizer the correct approach?

Thanks
Brendan

Reply via email to