Sébastien Launay a écrit :
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.
My mistake, in the fact that the date property is stored in ISO8601.
Indeed these properties are stored in a fixed length string suitable
for indexing and sorting which makes more sense :) :
http://fisheye6.atlassian.com/browse/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DateField.java?r=532464

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 disk.

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,

Sébastien.

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:
    //[EMAIL PROTECTED] = '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]

Reply via email to