jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1482908 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query: Query.java XPathToSQL2Converter.java ast/SelectorImpl.java
Date Wed, 15 May 2013 15:35:16 GMT
Author: thomasm
Date: Wed May 15 15:35:16 2013
New Revision: 1482908

URL: http://svn.apache.org/r1482908
Log:
OAK-262 Query: support pseudo properties like jcr:score() and rep:excerpt()

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.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/Query.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java?rev=1482908&r1=1482907&r2=1482908&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
Wed May 15 15:35:16 2013
@@ -76,6 +76,11 @@ public class Query {
      */
     public static final String JCR_SCORE = "jcr:score";
 
+    /**
+     * The "rep:excerpt" pseudo-property.
+     */
+    public static final String REP_EXCERPT = "rep:excerpt";
+
     private static final Logger LOG = LoggerFactory.getLogger(Query.class);
 
     final SourceImpl source;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java?rev=1482908&r1=1482907&r2=1482908&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
Wed May 15 15:35:16 2013
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.oak.query;
 
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
@@ -27,6 +29,8 @@ import java.util.ArrayList;
  */
 public class XPathToSQL2Converter {
 
+    static final Logger LOG = LoggerFactory.getLogger(XPathToSQL2Converter.class);
+
     // Character types, used during the tokenizer phase
     private static final int CHAR_END = -1, CHAR_VALUE = 2;
     private static final int CHAR_NAME = 4, CHAR_SPECIAL_1 = 5, CHAR_SPECIAL_2 = 6;

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=1482908&r1=1482907&r2=1482908&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
Wed May 15 15:35:16 2013
@@ -289,8 +289,6 @@ public class SelectorImpl extends Source
         if (r == null) {
             return null;
         }
-        // TODO support pseudo-properties such as jcr:score using
-        // r.getValue(columnName)
         String path = r.getPath();
         if (path == null) {
             return null;
@@ -321,6 +319,10 @@ public class SelectorImpl extends Source
                 return null;
             }
             return PropertyValues.newString(local);
+        } else if (propertyName.equals(Query.JCR_SCORE)) {
+            return currentRow.getValue(Query.JCR_SCORE);
+        } else if (propertyName.equals(Query.REP_EXCERPT)) {
+            return currentRow.getValue(Query.REP_EXCERPT);
         }
         return PropertyValues.create(t.getProperty(propertyName));
     }



Mime
View raw message