3
votes

Has anybody have experience implementing hierarchical faceting in this fashion? See link http://lucene.472066.n3.nabble.com/multi-level-faceting-td1629650.html#a1672083

What should the schema look like?

(I would like to implement tree faceting without use of SOLR-64. The patch works well on older branch, the only thing is that it doesn't patch solr trunk.)

1

1 Answers

3
votes

I don't have experience with the particular solution described in the mailing list post but during my last research into his area I stumbled upon the the Solr Bobo Browse integration. It also supports hierarchical faceting and seems quite mature.

If you want to stick with the pure Solr solution you would add a single multivalued field to the document for every aspect that you want to facet on. The example in the mailing list assumes that you have just one field called category.

In your schema XML you would add:

<field name="category" type="string" 
                               indexed="true" stored="true" multiValued="true" />

When you index you documents you would then index all levels of your hierarchy that the document belongs to with the hierarchy level as a prefix:

<category>1_sport</category>
<category>2_watersport</category>
<category>3_scuba_diving</category>

Querying and traversing the hierarchy once it is indexed is quite well explained in the mailing list.