jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakub Pawlowicz <cont...@jakubpawlowicz.com>
Subject Re: Searching by date
Date Mon, 22 Aug 2005 09:17:35 GMT
Hi Marcel,

After reading your message I tried to solve my problem once again.
I've used the ISO8601 class to encode java.util.Calendar object into  
a Jackrabbit-compliant value and now everything works as expected.

Many thanks for your explanation!
Best regards
Jakub

On Aug 22, 2005, at 10:11 AM, Marcel Reutegger wrote:

> Hi Jakub,
>
> JSR-170 specifies a type mapping from property types to types known  
> in XPath. The relevant section in the spec is: 6.6.4.4
>
> regarding your queries:
>
> > "//*[jcr:contains(@myDateProperty, '2005')]"
>
> jcr:contains relies on the fulltext index, which is only required  
> by jsr-170 on a per node basis. still, jackrabbit supports fulltext  
> queries with a property scope. the reason why the above query does  
> not return results is, that jackrabbit does not fulltext index date  
> properties. and I think it is ok, that jackrabbit doesn't do that.  
> your query would be certainly convenient to find all dates of the  
> year 2005, but that's probably the only useful use case. when it  
> comes to month and day a fulltext index would be unable to  
> distinguish them. both are just two digit numbers.
>
> > "//*[jcr:like(@myDateProperty, '2005-%')]"
>
> this query does not return nodes because jcr:like only works on  
> string properties and @myDateProperty is of type date.
>
> what will work is the following:
>
> //*[@myDateProperty >= xs:dateTime('2005-01-01T00:00:00.000TZ') and  
> @myDateProperty <= xs:dateTime('2005-12-31T23:59:59.999TZ')]
>
> you may also omit the xs:dateTime functions because jackrabbit does  
> some basic value coercing, which includes string to date conversion:
>
> //*[@myDateProperty >= '2005-01-01T00:00:00.000TZ' and  
> @myDateProperty <= '2005-12-31T23:59:59.999TZ']
>
> regards
>  marcel
>
>
> contact@jakubpawlowicz.com wrote:
>
>> Hi!
>> I've been playing with Jackrabbit for some time and I'm having   
>> problems with searching by properties with a date value   
>> (java.util.Calendar).
>> I'm trying to define a constraint to find only the nodes, let's  
>> say  from the year 2005.
>> So I'm trying to perform XPath queries like
>> "//*[jcr:contains(@myDateProperty, '2005')]" or
>> "//*[jcr:like(@myDateProperty, '2005-%')]"
>> But that doesn't work - each time a set of found nodes is empty.
>> Does anyone know how to perform that kind of searching?
>> Any help would be highly appreciated.
>> Best regards
>> Jakub
>>
>
>


Mime
View raw message