jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meteata...@apache.org
Subject svn commit: r1416486 - in /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action: FetchNodesAction.java FetchNodesActionNew.java
Date Mon, 03 Dec 2012 12:19:59 GMT
Author: meteatamel
Date: Mon Dec  3 12:19:58 2012
New Revision: 1416486

URL: http://svn.apache.org/viewvc?rev=1416486&view=rev
Log:
OAK-489 - FetchNodesAction need to limit the versions of a node

Avoid the regular expression overhead when a single path with depth = 0 is requested.

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesAction.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesActionNew.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesAction.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesAction.java?rev=1416486&r1=1416485&r2=1416486&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesAction.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesAction.java
Mon Dec  3 12:19:58 2012
@@ -74,7 +74,7 @@ public class FetchNodesAction extends Ba
      * @param paths The exact paths to fetch nodes for.
      * @param revisionId The revision id.
      */
-    public FetchNodesAction(MongoNodeStore nodeStore,  Set<String> paths, long revisionId)
{
+    public FetchNodesAction(MongoNodeStore nodeStore, Set<String> paths, long revisionId)
{
         super(nodeStore);
         this.paths = paths;
         this.revisionId = revisionId;
@@ -123,8 +123,12 @@ public class FetchNodesAction extends Ba
             queryBuilder = queryBuilder.in(paths);
         } else {
             String path = paths.toArray(new String[0])[0];
-            Pattern pattern = createPrefixRegExp(path);
-            queryBuilder = queryBuilder.regex(pattern);
+            if (depth == 0) {
+                queryBuilder = queryBuilder.is(path);
+            } else {
+                Pattern pattern = createPrefixRegExp(path);
+                queryBuilder = queryBuilder.regex(pattern);
+            }
         }
 
         if (revisionId > -1) {
@@ -160,10 +164,6 @@ public class FetchNodesAction extends Ba
         if (depth < 0) {
             sb.append("^");
             sb.append(quotedPath);
-        } else if (depth == 0) {
-            sb.append("^");
-            sb.append(quotedPath);
-            sb.append("$");
         } else if (depth > 0) {
             sb.append("^");
             if (!"/".equals(path)) {

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesActionNew.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesActionNew.java?rev=1416486&r1=1416485&r2=1416486&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesActionNew.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/action/FetchNodesActionNew.java
Mon Dec  3 12:19:58 2012
@@ -75,7 +75,7 @@ public class FetchNodesActionNew extends
      * @param paths The exact paths to fetch nodes for.
      * @param revisionId The revision id.
      */
-    public FetchNodesActionNew(MongoNodeStore nodeStore,  Set<String> paths, long revisionId)
{
+    public FetchNodesActionNew(MongoNodeStore nodeStore, Set<String> paths, long revisionId)
{
         super(nodeStore);
         this.paths = paths;
         this.revisionId = revisionId;
@@ -114,8 +114,12 @@ public class FetchNodesActionNew extends
             queryBuilder = queryBuilder.in(paths);
         } else {
             String path = paths.toArray(new String[0])[0];
-            Pattern pattern = createPrefixRegExp(path);
-            queryBuilder = queryBuilder.regex(pattern);
+            if (depth == 0) {
+                queryBuilder = queryBuilder.is(path);
+            } else {
+                Pattern pattern = createPrefixRegExp(path);
+                queryBuilder = queryBuilder.regex(pattern);
+            }
         }
 
         // FIXME - This needs to be improved to not fetch all revisions of a path.
@@ -152,10 +156,6 @@ public class FetchNodesActionNew extends
         if (depth < 0) {
             sb.append("^");
             sb.append(quotedPath);
-        } else if (depth == 0) {
-            sb.append("^");
-            sb.append(quotedPath);
-            sb.append("$");
         } else if (depth > 0) {
             sb.append("^");
             if (!"/".equals(path)) {



Mime
View raw message