Hi Ramon,

I think it is possible to accomplish this, although I do not know of any sample 
code to actually do this.  I have experimented with this a little, but have not 
got as far as making a working example.  I am not sure if my reasoning around 
this is 100% sound, but here is my thinking on this subject.   Maybe others 
have some other ideas.

 There are two parts to this, as I see it:


1)      you need to have data to support this

2)      you need to figure out a UI to display that data

For the data, each level in the hierarchy has to have its own facet with a set 
of unique values.  For example, say you have a hierarchy something like the 
following:

pub-type (book, magazine, article)
   book-type (novel, biography, reference)
   magazine-type (news, home, hobby)
   article-type (medical, news, personal)

Or whatever makes sense for your content.  Your data needs to have every level 
of the hierarchy above it.  So if you have magazine-type="news", it should also 
have pub-type="magazine".  If your data supports this properly, then a 
publication with a pub-type="magazine" will always have a magazine-type="news".

The code that generates the hierarchical facets would need knowledge of the 
hierarchy (or have to be able to run a query to gain knowledge of it).   For 
each individual facet, you can use the search API to generate the facet (or use 
cts:element-values and/or the other lexicon APIs to generate your own), but I 
think you would have to do a different search for each level of the hierarchy.  
When you click on a facet, you would then generate the facets for the next 
level.  So when you click on the book facet, you would then generate and 
display the facets for novel, biography, and reference.

Hopefully that can give you some ideas.

-Danny


From: [email protected] 
[mailto:[email protected]] On Behalf Of Ramon Felciano
Sent: Thursday, May 13, 2010 5:14 PM
To: [email protected]
Subject: [MarkLogic Dev General] Hierarchical facet support / examples in 
MarkLogic?

Hi -

I just attended my first MarkLogic user conference and liked the demos I saw, 
especially those that demonstrated the ability to build a faceted search 
application fully within MarkLogic. I'm looking to build a similar 
search-and-browse application for a document collection that is organized using 
tags from a very large hierarchical controlled vocabulary, and would like to 
use these tags as the basis for the faceted navigation. I was planning to use 
Lucene/Solr, but now am wondering whether I could do this largely within 
MarkLogic, but am getting stuck on how to auto-generate the facets within the 
UI.

Are there any examples showing how to dynamically construct *hierarchical* 
faceted UIs all within ML (e.g. using XQuery)?

Thanks,

Ramon

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to