jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Bellet <jbbel...@goojet.com>
Subject Re: Birthdate query
Date Thu, 03 Jul 2008 07:56:52 GMT
Hi Sébastien,

Thanks for your response.
So, what you cleary said is Jackrabbit isn't able to make some of this 
basics operations over the Date format. Do you know if this is on the 
road map for futur version ? Because this type of operation could be 
very usefull ... Not only for my case of course ! If someone has another 
solution ... :)
Thanks to all the team.

jb

Sébastien Launay wrote:
> 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:
>>>     //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]

Mime
View raw message