jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1023781 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join: ConstraintSplitter.java Constraints.java EquiJoinMerger.java JoinMerger.java
Date Mon, 18 Oct 2010 13:06:26 GMT
Author: jukka
Date: Mon Oct 18 13:06:25 2010
New Revision: 1023781

URL: http://svn.apache.org/viewvc?rev=1023781&view=rev
Log:
JCR-2715: Improved join query performance

Fix various errors

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Constraints.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/EquiJoinMerger.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/JoinMerger.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitter.java?rev=1023781&r1=1023780&r2=1023781&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ConstraintSplitter.java
Mon Oct 18 13:06:25 2010
@@ -85,7 +85,7 @@ class ConstraintSplitter {
      * @return the left constraint
      */
     public Constraint getLeftConstraint() throws RepositoryException {
-        return Constraints.and(factory,leftConstraints);
+        return Constraints.and(factory, leftConstraints);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Constraints.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Constraints.java?rev=1023781&r1=1023780&r2=1023781&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Constraints.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Constraints.java
Mon Oct 18 13:06:25 2010
@@ -37,7 +37,7 @@ public class Constraints {
             int m = n / 2;
             return factory.and(
                     and(factory, constraints.subList(0, m)),
-                    and(factory, constraints.subList(m + 1, n)));
+                    and(factory, constraints.subList(m, n)));
         }
     }
 
@@ -65,7 +65,7 @@ public class Constraints {
             int m = n / 2;
             return factory.or(
                     or(factory, constraints.subList(0, m)),
-                    or(factory, constraints.subList(m + 1, n)));
+                    or(factory, constraints.subList(m, n)));
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/EquiJoinMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/EquiJoinMerger.java?rev=1023781&r1=1023780&r2=1023781&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/EquiJoinMerger.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/EquiJoinMerger.java
Mon Oct 18 13:06:25 2010
@@ -58,8 +58,8 @@ class EquiJoinMerger extends JoinMerger 
             rightProperty = property2;
         } else if (leftSelectors.contains(property2.getSelectorName())
                 && rightSelectors.contains(property1.getSelectorName())) {
-            leftProperty = property1;
-            rightProperty = property2;
+            leftProperty = property2;
+            rightProperty = property1;
         } else {
             throw new RepositoryException("Invalid equi-join");
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/JoinMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/JoinMerger.java?rev=1023781&r1=1023780&r2=1023781&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/JoinMerger.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/JoinMerger.java
Mon Oct 18 13:06:25 2010
@@ -161,8 +161,8 @@ abstract class JoinMerger {
             return mergeRight(map, rightRows);
         } else {
             Map<String, List<Row>> map = new HashMap<String, List<Row>>();
-            for (Row row : new RowIterable(leftRows)) {
-                for (String value : getLeftValues(row)) {
+            for (Row row : new RowIterable(rightRows)) {
+                for (String value : getRightValues(row)) {
                     List<Row> rows = map.get(value);
                     if (rows == null) {
                         rows = new ArrayList<Row>();
@@ -179,12 +179,16 @@ abstract class JoinMerger {
     private QueryResult mergeLeft(
             RowIterator leftRows, Map<String, List<Row>> rightRowMap,
             boolean outer) throws RepositoryException {
+        System.out.println("Available right matches " + rightRowMap.keySet());
         List<Row> rows = new ArrayList<Row>();
         for (Row leftRow : new RowIterable(leftRows)) {
+            System.out.println("Finding matchers for left row " + leftRow);
             for (String value : getLeftValues(leftRow)) {
+                System.out.println(" - checking for matches for " + value);
                 List<Row> rightRows = rightRowMap.get(value);
-                if (leftRows != null) {
+                if (rightRows != null) {
                     for (Row rightRow : rightRows) {
+                        System.out.println(" -> found matching row " + rightRow);
                         rows.add(mergeRow(leftRow, rightRow));
                     }
                 } else if (outer) {



Mime
View raw message