Hi all,

I'm working on obtaining data using util:index-keys in order to build a faceted search filter, as described in this tutorial: http://rvdb.wordpress.com/2010/10/06/mimicking-faceted-searching-in-exist/

My question relates to dates.  I have been encoding dates using the TEI @when attribute.  However, I understand eXist's range index only works on valid xs:date attributes which need to be YYYY-MM-DD. The data is a humanities bibliography, so largely has publication dates which are year only, or sometimes year-month.  I can see a couple of options, but maybe there are others:

1) Index the @when as a string, ie <create qname="@when" type="xs:string"/>. This seems like a good option right now.  As my goal is to create a faceted search interface, I'm not sure if I lose much by recording dates as strings in the index. I want to be able to, say, narrow down search results by decade.  Any thoughts?  If I extract the date strings from my index and create facets, can I then cast them back to xs:date if that proves necessary?

2) Use a different attribute for non xs:date conforming date data, eg the TEI has @when-custom as an option for the date element.  The obvious downside to this is it puts my statistics for faceting into two places, ie @when and @when-custom.  The main use case is likely to be, 'Find all publications between these dates', so I suspect the data with year of publication only is going to be the most important to users.

Does anyone have thoughts or advice on this?