From users-return-16617-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Mon Nov 29 09:51:57 2010 Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 17553 invoked from network); 29 Nov 2010 09:51:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Nov 2010 09:51:57 -0000 Received: (qmail 58602 invoked by uid 500); 29 Nov 2010 09:51:57 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 58322 invoked by uid 500); 29 Nov 2010 09:51:55 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 58311 invoked by uid 99); 29 Nov 2010 09:51:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 09:51:54 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of a.schrijvers@1hippo.com designates 64.18.2.171 as permitted sender) Received: from [64.18.2.171] (HELO exprod7og109.obsmtp.com) (64.18.2.171) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 29 Nov 2010 09:51:49 +0000 Received: from source ([209.85.213.45]) by exprod7ob109.postini.com ([64.18.6.12]) with SMTP ID DSNKTPN3oCTyaRvgvl+LrJGTsgSppcGqcFLh@postini.com; Mon, 29 Nov 2010 01:51:29 PST Received: by ywo32 with SMTP id 32so1967978ywo.18 for ; Mon, 29 Nov 2010 01:51:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.150.195.12 with SMTP id s12mr590704ybf.8.1291024288380; Mon, 29 Nov 2010 01:51:28 -0800 (PST) Received: by 10.236.95.11 with HTTP; Mon, 29 Nov 2010 01:51:28 -0800 (PST) In-Reply-To: References: Date: Mon, 29 Nov 2010 10:51:28 +0100 Message-ID: Subject: Re: XPATH to JCR-SQL2 Query translation From: Ard Schrijvers To: users@jackrabbit.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Fri, Nov 26, 2010 at 4:48 PM, Nicolas Betheuil wrote: > I have discover recently that sql queries doesn't work pretty well on chi= ld nodes like your jcr:content should be a child node of any node of type m= ynt:document. > To make it working you must have a join on it. > Contains should only work on properties but maybe someone could tell the = opposite. > > To restrict an sql query on specific path you have the path function but = the syntax could be a little bit complicated (on array nodes and sub child = nodes). > > But, to come back to the start of your mail, it's not because you go to J= CR2.0 you must fell down XPATH, it's always there. The spec has deprecated = this query language but it's always implemented in the last version. If any= developer read it, i would be interested to know if there is any road map = about this. Do you plan to remove xpath support ? Afaik, xpath is there to stay, and currently even to be preferred in many occasions wrt performance Regards Ard > > If someone has an other opinion, idea, suggestion ? > > > -----Message d'origine----- > De=A0: Juan Diego Botiva Leon [mailto:juandbotiva@hotmail.com] > Envoy=E9=A0: vendredi 26 novembre 2010 16:36 > =C0=A0: users@jackrabbit.apache.org > Objet=A0: XPATH to JCR-SQL2 Query translation > > > > > > Hi! > > I'm upgrading Jackrabbit from 1.6.1 to 2.1.1 and I need to translate an X= Path query to JCR-SQL2, the query is as follows: > > /jcr:root/some_node//element(*, mynt:document)[jcr:contains(jcr:content, = 'textToFind')] > > I tried the following (removing the path constraint because I couldn't fi= nd how to do it) > > SELECT * FROM [mynt:document] AS doc WHERE CONTAINS(doc.*, 'textToFind') > > But I get no results and the original query returns 23 nodes. Can you hel= p me with this as I checked the JCR 2.0 SQL-2 Grammar (Railroad diagrams) a= nd the jackrabbit-spi-commons test cases but still I'm not sure how to use = CONTAINS and how to restrict the query to a specific path. Thanks in advanc= e. > > Regards > > Juan Botiva > > --=20 Hippo Europe =A0=95 =A0Amsterdam =A0Oosteinde 11 =A0=95 =A01017 WT Amsterdam =A0= =95 =A0+31 (0)20 522 4466 USA =A0=95 San Francisco =A0185 H Street Suite B =A0=95 =A0Petaluma CA 9495= 2-5100 =95 =A0+1 (707) 773 4646 Canada =A0 =A0=95 =A0 Montr=E9al =A05369 Boulevard St-Laurent =A0=95 =A0Mon= tr=E9al QC H2T 1S5 =A0=95 =A0+1 (514) 316 8966 www.onehippo.com =A0=95 =A0www.onehippo.org =A0=95 =A0info@onehippo.com