jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1346307 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
Date Tue, 05 Jun 2012 09:23:39 GMT
Author: thomasm
Date: Tue Jun  5 09:23:39 2012
New Revision: 1346307

URL: http://svn.apache.org/viewvc?rev=1346307&view=rev
Log:
OAK-28 Query implementation - support "explain", simplify filtering

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java?rev=1346307&r1=1346306&r2=1346307&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
Tue Jun  5 09:23:39 2012
@@ -66,6 +66,17 @@ public class QueryResultImpl implements 
         return result.getSelectorNames();
     }
 
+    boolean includeRow(String path) {
+        if (path == null) {
+            // a row without path (explain,...)
+            return true;
+        } else if (PathUtils.isAncestor(pathFilter, path)) {
+            // a row within this workspace
+            return true;
+        }
+        return false;
+    }
+
     @Override
     public RowIterator getRows() throws RepositoryException {
         Iterator<RowImpl> it = new Iterator<RowImpl>() {
@@ -83,7 +94,7 @@ public class QueryResultImpl implements 
                     ResultRow r = it.next();
                     for (String s : getSelectorNames()) {
                         String path = r.getPath(s);
-                        if (PathUtils.isAncestor(pathFilter, path)) {
+                        if (includeRow(path)) {
                             current = new RowImpl(QueryResultImpl.this, r);
                             return;
                         }
@@ -145,7 +156,7 @@ public class QueryResultImpl implements 
                 while(it.hasNext()) {
                     ResultRow r = it.next();
                     String path = r.getPath();
-                    if (PathUtils.isAncestor(pathFilter, path)) {
+                    if (includeRow(path)) {
                         current = getNode(getLocalPath(path));
                         break;
                     }



Mime
View raw message