Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 50395 invoked from network); 22 Aug 2005 09:18:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Aug 2005 09:18:42 -0000 Received: (qmail 18169 invoked by uid 500); 22 Aug 2005 09:18:40 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 18156 invoked by uid 99); 22 Aug 2005 09:18:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Aug 2005 02:18:40 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of contact@jakubpawlowicz.com designates 195.242.92.4 as permitted sender) Received: from [195.242.92.4] (HELO gamma.nq.pl) (195.242.92.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Aug 2005 02:18:58 -0700 Received: from [192.168.127.42] (jakub30.net.autocom.pl [213.134.176.61]) (authenticated bits=0) by gamma.nq.pl (8.13.3/8.13.3) with ESMTP id j7M9HaP8009427 for ; Mon, 22 Aug 2005 11:17:37 +0200 Mime-Version: 1.0 (Apple Message framework v734) In-Reply-To: <43098894.5030802@gmx.net> References: <43098894.5030802@gmx.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Jakub Pawlowicz Subject: Re: Searching by date Date: Mon, 22 Aug 2005 11:17:35 +0200 To: jackrabbit-dev@incubator.apache.org X-Mailer: Apple Mail (2.734) X-nQ.pl-MailScanner-Information: Please contact the ISP for more information X-nQ.pl-MailScanner: Found to be clean X-nQ.pl-MailScanner-From: contact@jakubpawlowicz.com X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 >> > >