jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1142696 - in /jackrabbit/branches/2.2/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitInfo.java test/java/org/apache/jackrabbit/core/query/JoinTest.java
Date Mon, 04 Jul 2011 14:45:21 GMT
Author: alexparvulescu
Date: Mon Jul  4 14:45:21 2011
New Revision: 1142696

URL: http://svn.apache.org/viewvc?rev=1142696&view=rev
Log:
2.2: merged revision #1142693 (JCR-3000 SQL2 Join with OR clause still has some issues)

Modified:
    jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitInfo.java
    jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/JoinTest.java

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitInfo.java?rev=1142696&r1=1142695&r2=1142696&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitInfo.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitInfo.java
Mon Jul  4 14:45:21 2011
@@ -35,9 +35,9 @@ class ConstraintSplitInfo {
     private final List<Constraint> rightConstraints;
 
     private boolean isMultiple;
-    
+
     private boolean hasLeftConstraints;
-    
+
     private boolean hasRightConstraints;
 
     private ConstraintSplitInfo leftInnerConstraints = null;
@@ -91,11 +91,15 @@ class ConstraintSplitInfo {
         ConstraintSplitInfo csi1 = new ConstraintSplitInfo(factory, source,
                 new ArrayList<Constraint>(leftConstraints),
                 new ArrayList<Constraint>(rightConstraints));
+        csi1.hasLeftConstraints = this.hasLeftConstraints;
+        csi1.hasRightConstraints = this.hasRightConstraints;
         this.leftInnerConstraints = csi1;
 
         ConstraintSplitInfo csi2 = new ConstraintSplitInfo(factory, source,
                 new ArrayList<Constraint>(leftConstraints),
                 new ArrayList<Constraint>(rightConstraints));
+        csi2.hasLeftConstraints = this.hasLeftConstraints;
+        csi2.hasRightConstraints = this.hasRightConstraints;
         this.rightInnerConstraints = csi2;
 
         this.leftConstraints.clear();

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/JoinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/JoinTest.java?rev=1142696&r1=1142695&r2=1142696&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/JoinTest.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/JoinTest.java
Mon Jul  4 14:45:21 2011
@@ -40,15 +40,20 @@ public class JoinTest extends AbstractQu
 
         n1 = node.addNode("node1", "nt:unstructured");
         n1.addMixin(NodeType.MIX_REFERENCEABLE);
+        n1.setProperty("type", "child");
+        n1.setProperty("testJoinWithOR4", "testJoinWithOR4");
 
         n2 = node.addNode("node2", "nt:unstructured");
         n2.addMixin(NodeType.MIX_REFERENCEABLE);
+        n2.setProperty("type", "child");
 
         Node n3 = node.addNode("node3", "nt:unstructured");
         n3.addMixin(NodeType.MIX_REFERENCEABLE);
         n3.setProperty("testref",
                 new String[] { n1.getIdentifier(), n2.getIdentifier() },
                 PropertyType.REFERENCE);
+        n3.setProperty("type", "parent");
+        n3.setProperty("testJoinWithOR4", "testJoinWithOR4");
 
         Node parent2 = testRootNode
                 .addNode("jointest_other", "nt:unstructured");
@@ -122,6 +127,27 @@ public class JoinTest extends AbstractQu
         checkResult(result, 1);
     }
 
+    public void testJoinWithOR4() throws Exception {
+
+        StringBuilder join = new StringBuilder(
+                "SELECT a.*, b.* FROM [nt:unstructured] AS a");
+        join.append("  INNER JOIN [nt:unstructured] AS b ON a.[jcr:uuid] = b.testref ");
+        join.append("  WHERE  ");
+        join.append("  a.type = 'child' ");
+        join.append("  AND (");
+        join.append("    CONTAINS(a.*, 'testJoinWithOR4')  ");
+        join.append("    OR ");
+        join.append("    b.type = 'parent' ");
+        join.append("    AND ");
+        join.append("    CONTAINS(b.*, 'testJoinWithOR4') ");
+        join.append("  )");
+
+        Query q = qm.createQuery(join.toString(), Query.JCR_SQL2);
+        QueryResult result = q.execute();
+        checkResult(result, 2);
+
+    }
+
     /**
      * Test case for <a
      * href="https://issues.apache.org/jira/browse/JCR-2852">JCR-2852</a> <br>



Mime
View raw message