Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 12866 invoked from network); 26 Nov 2010 15:49:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Nov 2010 15:49:22 -0000 Received: (qmail 37163 invoked by uid 500); 26 Nov 2010 15:49:22 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 36846 invoked by uid 500); 26 Nov 2010 15:49:20 -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 36832 invoked by uid 99); 26 Nov 2010 15:49:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Nov 2010 15:49:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.108.10.20] (HELO mail1.europe.adp.com) (217.108.10.20) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Nov 2010 15:49:10 +0000 Received: from EXCHSUR3.gaia.fr ([150.175.3.28]) by ppa1p.europe.adp.com (8.14.3/8.14.3) with ESMTP id oAQFmnWp014160 for ; Fri, 26 Nov 2010 16:48:49 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: XPATH to JCR-SQL2 Query translation Date: Fri, 26 Nov 2010 16:48:48 +0100 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: XPATH to JCR-SQL2 Query translation Thread-Index: AcuNf8aHw9tcLA9bRu617S6EBjxt0QAADmNA References: From: "Nicolas Betheuil" To: X-Origincountry: English X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15,1.0.148,0.0.0000 definitions=2010-11-26_07:2010-11-26,2010-11-26,1970-01-01 signatures=0 X-Virus-Checked: Checked by ClamAV on apache.org I have discover recently that sql queries doesn't work pretty well on = child nodes like your jcr:content should be a child node of any node of = type mynt:document. To make it working you must have a join on it.=20 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 = JCR2.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 ? If someone has an other opinion, idea, suggestion ? -----Message d'origine----- De=A0: Juan Diego Botiva Leon [mailto:juandbotiva@hotmail.com]=20 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 = XPath 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 = find 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 = help me with this as I checked the JCR 2.0 SQL-2 Grammar (Railroad = diagrams) and 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 advance. Regards Juan Botiva =20