That's a good way. How does it perform? Another way would be to store the "parent" topics in a field. Whenever a parent node is drilled-into, simply search for all documents with that parent. Perhaps not as elegant as your approach though.
I'd be interested in the performance comparison between the two approaches. > I have a hierarchical taxonomy of documents that I would like users to be > able to search either through search or "drill-down" faceting. The > documents may appear at multiple points in the hierarchy. I've got a > solution working as follows: a multivalued field labelled category which > for > each document defines where in the tree it should appear. For example: > doc1 > has the category field set to "0/topics", "1/topics/computing", > "2/topic/computing/systems". > > I then facet on the 'category' field, filter the results with fq={!raw > f=category}1/topics/computing to get everything below that point on the > tree, and use f.category.facet.prefix to restrict the facet fields to the > current level. > > Full query something like: > > http://localhost:8080/solr/select/?q=something&facet=true&facet.field=category&fq={!rawf=category}1/topics/computing&f.category.facet.prefix=2/topic/computing > > > Playing around with the results, it seems to work ok but despite reading > lots about faceting I can't help feel there might be a better solution. > Are > there better ways to achieve this? Any comments/suggestions are welcome. > > (Any suggestions as to what interface I can put on top of this are also > gratefully received!). > > > Thanks, > > Russell >