jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1433348 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/ast/ test/resources/org/apache/jackrabbit/oak/query/
Date Tue, 15 Jan 2013 10:51:18 GMT
Author: thomasm
Date: Tue Jan 15 10:51:17 2013
New Revision: 1433348

URL: http://svn.apache.org/viewvc?rev=1433348&view=rev
Log:
OAK-556 Query engine: support fulltext conditions with relative paths

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java?rev=1433348&r1=1433347&r2=1433348&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
Tue Jan 15 10:51:17 2013
@@ -55,7 +55,7 @@ public class ColumnImpl extends AstEleme
     }
 
     public PropertyValue currentProperty() {
-        if (propertyName == null) {
+        if (propertyName == null || propertyName.equals("*")) {
             // TODO for SELECT * FROM queries, currently return the path (for testing only)
             String p = selector.currentPath();
             if (p == 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=1433348&r1=1433347&r2=1433348&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
Tue Jan 15 10:51:17 2013
@@ -34,6 +34,7 @@ import org.apache.jackrabbit.JcrConstant
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.PropertyValue;
 import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
@@ -47,6 +48,7 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
 
 /**
  * A selector within a query.
@@ -253,6 +255,8 @@ public class SelectorImpl extends Source
                 }
                 if (p.equals("..")) {
                     t = t.getParent();
+                } else if (p.equals(".")) {
+                    // same node
                 } else {
                     t = t.getChild(p);
                 }
@@ -270,6 +274,16 @@ public class SelectorImpl extends Source
             }
             return PropertyValues.newString(local);
         }
+        if (propertyName.equals("*")) {
+            // TODO currently all property values are converted to strings - 
+            // this doesn't play well with the idea that the types may be different
+            List<String> values = new ArrayList<String>();
+            for (PropertyState p : t.getProperties()) {
+                Iterables.addAll(values, p.getValue(Type.STRINGS));
+            }
+            // "*"
+            return PropertyValues.newString(values);
+        } 
         return PropertyValues.create(t.getProperty(propertyName));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt?rev=1433348&r1=1433347&r2=1433348&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
Tue Jan 15 10:51:17 2013
@@ -83,7 +83,7 @@ select * from [nt:base] where id = '10'
 /test/a
 
 select [jcr:path], * from [nt:base] where id = '10'
-/test/a, null
+/test/a, /test/a
 
 select * from [nt:base] where id > '10'
 /test/b

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt?rev=1433348&r1=1433347&r2=1433348&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
Tue Jan 15 10:51:17 2013
@@ -78,7 +78,7 @@ select * from [nt:base] where id = '10'
 /test/a
 
 select [jcr:path], * from [nt:base] where id = '10'
-/test/a, null
+/test/a, /test/a
 
 explain select * from [nt:base] where id > '10'
 [nt:base] as [nt:base] /* traverse "//*" where [nt:base].[id] > cast('10' as string) */



Mime
View raw message