Darren, One challenge for me is that a term can appear in multiple places of the hierarchy. So it's not safe to simply use the term as it appears to get its children; I probably need to include the entire tree path up to this term. For example, if the hierarchy is "Cardiovascular Diseases > Arteriosclerosis > Coronary Artery Disease", and I'm getting the children of the middle term Arteriosclerosi, I need to filter on something like "parent:Cardiovascular Diseases/Arteriosclerosis".
I'm having trouble figuring out how I can get the complete path per above to add to the URL of each facet term. I know "velocity/facet_field.vm" is where I build the URL. I know how to simply add a "parent:<term>" filter to the URL. But I don't know how to access a document field, like the complete parent path, in "facet_field.vm". Any help would be great. Yuhao ________________________________ From: "dar...@ontrenet.com" <dar...@ontrenet.com> To: Yuhao <nfsvi...@yahoo.com> Cc: solr-user@lucene.apache.org Sent: Monday, January 23, 2012 7:16 PM Subject: Re: Hierarchical faceting in UI On Mon, 23 Jan 2012 14:33:00 -0800 (PST), Yuhao <nfsvi...@yahoo.com> wrote: > Programmatically, something like this might work: for each facet field, > add another hidden field that identifies its parent. Then, program > additional logic in the UI to show only the facet terms at the currently > selected level. For example, if one filters on "cat:electronics", the new > UI logic would apply the additional filter "cat_parent:electronics". Can > this be done? Yes. This is how I do it. > Would it be a lot of work? No. Its not a lot of work, simply represent your hierarchy as parent/child relations in the document fields and in your UI drill down by issuing new faceted searches. Use the current facet (tree level) as the parent:<level> in the next query. Its much easier than other suggestions for this. > Is there a better way? Not in my opinion, there isn't. This is the simplest to implement and understand. > > By the way, Flamenco (another faceted browser) has built-in support for > hierarchies, and it has worked well for my data in this aspect (but less > well than Solr in others). I'm looking for the same kind of hierarchical > UI feature in Solr.