[Hippo-cms7-user] Using properties of a date sub node as facets

(Berry) A.W. van Halderen b.vanhalderen at onehippo.com
Fri Apr 24 10:23:38 CEST 2009


On Thu, Apr 23, 2009 at 03:21:12PM -0700, Niels van Kampenhout wrote:
> According to HREPTWO-601 [1] and HREPTWO-2254 [2] I should now
> (>2.05.00) be able to create a facet search using parts of a date
> field (e.g. year, month, etc.). I noticed date fields are now
> represented as a child node containing various properties
> (hippostd:year, hippostd:month, etc.). I tried adding them as facets
> to a facet search node, but did not see any of them in the resulting
> virtual node tree. Is there anything special I need to do to use this?

Within the facet search node, you need to provide a relative path to
the facet item.  For instance, if you have a node definition for a document:

  [mynamespace:mydocument] > hippo:document
  + mynamespace:creationdate (hippostd:date) = hippostd:date
  + mynamespace:modificationdate (hippostd:date) = hippostd:date

And you want to do a facet search on using the year followed by month of
the creation date, then create a facet search node of primary node type
"hippo:facetsearch" with the properties:
  hippo:queryname = test  [string value, any unique description will do]
  hippo:docbase   = ..    [uuid reference to starting node of the facet search]
  hippo:facets    = mynamespace::creationdate/hippostd:year
                    mynamespace::creationdate/hippostd:month
                                                      [multi-valued string]

The unit test in addon/faceteddate/repository/src/test/java/org/hippoecm/
faceteddate/DerivedDateTest.java shows the programmatic implementation.
Note that there are two ways, where using the node type hippostd:date
is recommended, this saves all kind of hassle, so if you use hippostd:date
you can forget all the things in the setUp class.  Using the
hippostd:datefields is supported, but you need to write your own
indexing_configuration.xml and provide (i.e. in the unit test done as a copy)
the derived data function.

\Berry
-- 
Berry A.W. van Halderen       b.vanhalderen at onehippo.com / berry at halderen.net
Disclaimer: the above is the author's personal opinion and is not the opinion
or policy of his employer or of the little green men that have been following
him all day.



More information about the Hippo-cms7-user mailing list