jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1537503 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast: AstElement.java FullTextSearchImpl.java PropertyValueImpl.java SelectorImpl.java
Date Thu, 31 Oct 2013 14:25:22 GMT
Author: thomasm
Date: Thu Oct 31 14:25:22 2013
New Revision: 1537503

URL: http://svn.apache.org/r1537503
Log:
OAK-1130 Query: Performance issues with MutableTree

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java?rev=1537503&r1=1537502&r2=1537503&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java
Thu Oct 31 14:25:22 2013
@@ -19,7 +19,6 @@
 package org.apache.jackrabbit.oak.query.ast;
 
 import org.apache.jackrabbit.oak.api.PropertyValue;
-import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.query.QueryImpl;
 import org.apache.jackrabbit.oak.spi.query.PropertyValues;
@@ -122,9 +121,5 @@ abstract class AstElement {
         return path;
     }
 
-    protected Tree getTree(String path) {
-        return query.getTree(path);
-    }
-
 }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java?rev=1537503&r1=1537502&r2=1537503&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
Thu Oct 31 14:25:22 2013
@@ -192,7 +192,7 @@ public class FullTextSearchImpl extends 
                 path = PathUtils.concat(path, rp);
             }
 
-            Tree tree = getTree(path);
+            Tree tree = selector.getTree(path);
             if (tree == null || !tree.exists()) {
                 return false;
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java?rev=1537503&r1=1537502&r2=1537503&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
Thu Oct 31 14:25:22 2013
@@ -112,7 +112,7 @@ public class PropertyValueImpl extends D
             PropertyValue p = selector.currentProperty(propertyName);
             return matchesPropertyType(p) ? p : null;
         }
-        Tree tree = getTree(selector.currentPath());
+        Tree tree = selector.currentTree();
         if (tree == null || !tree.exists()) {
             return null;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java?rev=1537503&r1=1537502&r2=1537503&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
Thu Oct 31 14:25:22 2013
@@ -94,6 +94,9 @@ public class SelectorImpl extends Source
     private Cursor cursor;
     private IndexRow currentRow;
     private int scanCount;
+    
+    private Tree lastTree;
+    private String lastPath;
 
     /**
      * The selector condition can be evaluated when the given selector is
@@ -344,6 +347,11 @@ public class SelectorImpl extends Source
         return cursor == null ? null : currentRow.getPath();
     }
     
+    /**
+     * Get the tree at the current path.
+     * 
+     * @return the current tree, or null
+     */
     public Tree currentTree() {
         String path = currentPath();
         if (path == null) {
@@ -351,6 +359,20 @@ public class SelectorImpl extends Source
         }
         return getTree(path);
     }
+    
+    /**
+     * Get the tree at the given path.
+     * 
+     * @param path the path
+     * @return the tree, or null
+     */
+    Tree getTree(String path) {
+        if (lastPath == null || !path.equals(lastPath)) {
+            lastTree = query.getTree(path);
+            lastPath = path;
+        }
+        return lastTree;
+    }
 
     /**
      * The value for the given selector for the current node.



Mime
View raw message