Hi James,

IMHO this construct is not what Jackrabbit should do or can do well. You can save the data that way or others, however to query it later (usually for display on a website etc.) you might want to have a look at SOLR (http://lucene.apache.org/solr/). An example for facting is under http://www.lucidimagination.com/Community/Hear-from-the-Experts/Articles/Faceted-Search-Solr explained.

Think that faceting isn't only the type/ product path - its the n-relevant feature/type path on a possible subsize/ submass of the original set. Usually faceting therefore is unique per page visit. Meaning you will have many concurrent facets from different sources on a different (sub)set. This could be done in jackrabbit, but IMHO won't scale nearly as well as a specialized search solution like SOLR where it won't matter if you have 10 products or 10 million products.

Best,

Korbinian

PS: SOLR is Lucene, too :)

Am 23.08.10 13:08, schrieb Gadbury:

Hi all,

I am trying to work out a good way to implement faceted search for products
in an ecommerce solution.  Please consider the following diagram which shows
the structure of my categories and products:

http://jackrabbit.510166.n4.nabble.com/file/n2334944/category-product_structure.png

I have the following custom node types which implement mix:referenceable so
they eachhave a unique UUID:

- Category (i.e. hardware)
- FacetType (i.e. manufacturer, warranty)
- FacetValue (i.e. amd, intel, samsung, 1 year, 2 years, 3 years)

A product has a number of properties but of importance here are the
following properties which are weak references (a String representing the
UUID(s) ) to the nodes Category and FacetValue:

- categoryUUIDs
- facetvalueUUIDs

Currently I am tracking the facet type values the user has selected and
adding them to a query, which retrieves the relevant products.  This works
although it may be slow with many products!  Here is an example of the XPath
query:

//element(*,
jpg:product)[...@jpg:categoryUUIDs='d93681a3-8b4e-4c2a-9dcb-a219848f8f3a' and
((@jpg:facetvalueUUIDs='70588aa9-6cb1-4ee1-af95-a21f78968e74') and
(@jpg:facetvalueUUIDs='bec141e8-f4c5-41c5-9cef-560dab296750'))] order by
@jpg:cost

Once the query is executed, I am iterating over all products, and getting:

each unique facet type UUID and name
each unique facet value UUID and name
a count of each occurence of a facetValueUUID

This data is presented back to the user to offer them a selection of facets
to filter by.  For example:

Manufacturer:
amd [2]
intel [3]
samsung [5]

Warranty
1 year [3]
3 years [7]

I know this works but I am sure there must be a more efficient / refined way
to do this... perhaps I am completely misunderstanding Jackrabbit and how to
get the most out of Lucene.  Is there another way that I should consider
doing this?  I would really appreciate any suggestions / improvements.

Thanks for reading and kind regards,

James

Reply via email to