Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 1433 invoked from network); 12 Oct 2006 22:56:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Oct 2006 22:56:21 -0000 Received: (qmail 90473 invoked by uid 500); 12 Oct 2006 22:56:20 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 90448 invoked by uid 500); 12 Oct 2006 22:56:20 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 90439 invoked by uid 99); 12 Oct 2006 22:56:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Oct 2006 15:56:19 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Oct 2006 15:56:19 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 274F57142D8 for ; Thu, 12 Oct 2006 15:55:36 -0700 (PDT) Message-ID: <26817016.1160693736157.JavaMail.jira@brutus> Date: Thu, 12 Oct 2006 15:55:36 -0700 (PDT) From: "Przemo Pakulski (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Updated: (JCR-562) 'OR' in XPath query badly interpreted In-Reply-To: <9582064.1157526082360.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/JCR-562?page=all ] Przemo Pakulski updated JCR-562: -------------------------------- Attachment: JCR-562.patch The attached patch contains fix and following test case : public void testLogicalExpression() throws Exception { Node foo = testRootNode.addNode("foo"); foo.setProperty("a", 1); foo.setProperty("b", 2); foo.setProperty("c", 3); Node bar = testRootNode.addNode("bar"); bar.setProperty("a", 0); bar.setProperty("b", 2); bar.setProperty("c", 0); Node bla = testRootNode.addNode("bla"); bla.setProperty("a", 1); bla.setProperty("b", 0); bla.setProperty("c", 3); testRootNode.save(); String sql = "SELECT * FROM nt:unstructured WHERE a=1 and b=2 or c=3"; Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); QueryResult result = q.execute(); checkResult(result, new Node[]{foo, bla}); String xpath = "//*[@a=1 and @b=2 or @c=3] "; q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH); result = q.execute(); checkResult(result, new Node[]{foo, bla}); } > 'OR' in XPath query badly interpreted > ------------------------------------- > > Key: JCR-562 > URL: http://issues.apache.org/jira/browse/JCR-562 > Project: Jackrabbit > Issue Type: Bug > Components: core > Affects Versions: 1.0.1 > Reporter: Szymon Kuzniak > Attachments: JCR-562.patch, tree.JPG > > > executing query: //*[@a=1 and @b=2 or @c=3] leads to creating wrong query tree. The builded tree looks like for query: //*[@a=1 and @b=2 and @c=3](see attachement). using brackets resolves the problem, but without brackets output query is different from input query. When AND and OR are switched(so the OR is in first palce - //*[@a=1 or @b=2 and @c=3]) everything is ok. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira