The PathHierarchyTokenizerFactory is intended for file path therefore
assumes that all documents should be indexed with all of the paths to the
parent folders but you are trying to use it for a taxonomy so you can't
simply use the PathHierarchyTokenizerFactory.   Use the analysis page (
http://localhost:8983/solr/admin/analysis.jsp) so that you can see what's
happening with the content both at index and query time.

    Field  (Type)  text_path
    Field value (Index)  red/pink
    Field value (Query) red/pink
You'd notice that the result of both is identical, therefore explaining why
both documents are retrieved:

    Index Analyzer:
       red
       red/pink
    Query Analyzer:
       red
       red/pink

 Carlos

-----Original Message-----
From: Darren Govoni [mailto:dar...@ontrenet.com]
Sent: Wednesday, April 18, 2012 8:10 AM
To: solr-user@lucene.apache.org
Subject: Re: hierarchical faceting?



Put the parent term in all the child documents at index time and the
re-issue the facet query when you expand the parent using the parent's
term. works perfect.



On Wed, 2012-04-18 at 10:56 -0400, sam ” wrote:

> I have hierarchical colors:

> <field name="colors"             type="text_path"    indexed="true"

> stored="true" multiValued="true"/>

> text_path is TextField with PathHierarchyTokenizerFactory as tokenizer.

>

> Given these two documents,

> Doc1: red

> Doc2: red/pink

>

> I want the result to be the following:

> ?fq=red

> ==> Doc1, Doc2

>

> ?fq=red/pink

> ==> Doc2

>

> But, with PathHierarchyTokenizer, Doc1 is included for the query:

> ?fq=red/pink

> ==> Doc1, Doc2

>

> How can I query for hierarchical facets?

> http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix..

> But it looks too cumbersome to me.

>

> Is there a simpler way to implement hierarchical facets?

Reply via email to