jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Launay <sebastien.lau...@anyware-tech.com>
Subject Re: Birthdate query
Date Mon, 30 Jun 2008 17:59:05 GMT
Hi JB,

None of the functions you describre are currently supported by Jackrabbit.
A date property is stored in the lucene index using ISO8601 format for
using < and > operator efficiency.

The most efficient way IMHO is to have another date property which will
contain the same the value but with a same fixed year.
The drawback is that you must maintain the integrity of the two fields at
each update.

But i think the duplicity is worth the effort hence it will consume more 

Note that you will need to use xs:datetime('XXXX-06-30T00:00:00.000+00:00')
with operator >= and <.

You can also use a string property with month and day concatenated ("06/30")
but the query will not be so fine grained (users born on the same hour :)).

Best regards,


Jean-Baptiste Bellet a écrit :
> Hi,
> I'm using jackrabbit and I'm trying to execute a query in order to 
> retrieve 'users', registered in JCR, who have a birthdate 
> corresponding to the current date.
> For example if a user was born on june the 30th, 1992 I want to 
> compare the user's birthdate with june the 30th (and without the year 
> wich is not important in this case). I have tried a lot of queries, 
> but without success.
> Any idea on how to perform such a query?
> Thanks a lot,
> jb
> This one works:
>     //user[@birthDate = '1992-06-30T14:36:24.292+01:00']
> These do not work:
>     //user[substring(@birthDate, 1, 1) = '1']
>     //user[substring(fn:string(@birthDate), 1, 1) = '1']
>     //user[concat(substring(@birthDate, 6, 2), substring(@birthDate, 
> 9, 2)) = '0630']
>     //user[fn:month-from-dateTime(@birthDate) = 6]
>     //user[fn:month-from-dateTime(./@birthDate/value()) = 6]

View raw message