Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1106ADBA2 for ; Mon, 20 Aug 2012 09:57:40 +0000 (UTC) Received: (qmail 37035 invoked by uid 500); 20 Aug 2012 09:57:39 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 36857 invoked by uid 500); 20 Aug 2012 09:57:38 -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 36832 invoked by uid 99); 20 Aug 2012 09:57:38 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2012 09:57:38 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 007772C04AC for ; Mon, 20 Aug 2012 09:57:37 +0000 (UTC) Date: Mon, 20 Aug 2012 20:57:37 +1100 (NCT) From: "Dmitry Kuleshov (JIRA)" To: dev@jackrabbit.apache.org Message-ID: <291117638.29492.1345456658002.JavaMail.jiratomcat@arcas> In-Reply-To: <1908675344.29491.1345456537947.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (JCR-3413) Query with CONTAINS OR LIKE expression returns malformed result MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JCR-3413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dmitry Kuleshov updated JCR-3413: --------------------------------- Description: Seems that JCR-SQL queries with {{CONTAINS OR LIKE}} expressions return malformed results. The behavior is like {{AND}} operator is used to evaluate the results, though {{OR}} operator is mentioned in the query. To simplify The following test is failing {code} public void testLikeOrContainsClauses() throws Exception { Node foo = testRootNode.addNode("foo"); foo.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."}); Node foo2 = testRootNode.addNode("foo2"); foo2.setProperty("mytext", new String[]{"the quick brown dinosaur jumps over the lazy dog."}); testRootNode.save(); String sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') " + "AND jcr:path LIKE '" + testRoot + "/foo2'"; Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); QueryResult result = q.execute(); checkResult(result, 0); sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') "; q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); result = q.execute(); checkResult(result, 1); sql = "SELECT * FROM nt:unstructured WHERE jcr:path LIKE '" + testRoot + "/foo2'"; q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); result = q.execute(); checkResult(result, 1); sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') " + "OR jcr:path LIKE '" + testRoot + "/foo2'"; q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); result = q.execute(); checkResult(result, 2); } {code} was: Seems that JCR-SQL queries with {{CONTAINS OR LIKE}} expressions return malformed results. The behavior is like {{AND}} operator is used to evaluate the results, though {{OR}} operator is mentioned in the query. To simplify The following test is failing {code:java} public void testLikeOrContainsClauses() throws Exception { Node foo = testRootNode.addNode("foo"); foo.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."}); Node foo2 = testRootNode.addNode("foo2"); foo2.setProperty("mytext", new String[]{"the quick brown dinosaur jumps over the lazy dog."}); testRootNode.save(); String sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') " + "AND jcr:path LIKE '" + testRoot + "/foo2'"; Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); QueryResult result = q.execute(); checkResult(result, 0); sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') "; q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); result = q.execute(); checkResult(result, 1); sql = "SELECT * FROM nt:unstructured WHERE jcr:path LIKE '" + testRoot + "/foo2'"; q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); result = q.execute(); checkResult(result, 1); sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') " + "OR jcr:path LIKE '" + testRoot + "/foo2'"; q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); result = q.execute(); checkResult(result, 2); } {code} > Query with CONTAINS OR LIKE expression returns malformed result > --------------------------------------------------------------- > > Key: JCR-3413 > URL: https://issues.apache.org/jira/browse/JCR-3413 > Project: Jackrabbit Content Repository > Issue Type: Bug > Components: jackrabbit-core > Reporter: Dmitry Kuleshov > > Seems that JCR-SQL queries with {{CONTAINS OR LIKE}} expressions return malformed results. > The behavior is like {{AND}} operator is used to evaluate the results, though {{OR}} operator is mentioned in the query. > To simplify The following test is failing > {code} > public void testLikeOrContainsClauses() throws Exception > { > Node foo = testRootNode.addNode("foo"); > foo.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."}); > Node foo2 = testRootNode.addNode("foo2"); > foo2.setProperty("mytext", new String[]{"the quick brown dinosaur jumps over the lazy dog."}); > testRootNode.save(); > String sql = > "SELECT * FROM nt:unstructured WHERE contains(., 'fox') " + "AND jcr:path LIKE '" + testRoot + "/foo2'"; > Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); > QueryResult result = q.execute(); > checkResult(result, 0); > sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') "; > q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); > result = q.execute(); > checkResult(result, 1); > sql = "SELECT * FROM nt:unstructured WHERE jcr:path LIKE '" + testRoot + "/foo2'"; > q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); > result = q.execute(); > checkResult(result, 1); > sql = "SELECT * FROM nt:unstructured WHERE contains(., 'fox') " + "OR jcr:path LIKE '" + testRoot + "/foo2'"; > q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); > result = q.execute(); > checkResult(result, 2); > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira