jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r167916 - in /incubator/jackrabbit/trunk/src: java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java test/org/apache/jackrabbit/core/query/OrderByTest.java
Date Tue, 03 May 2005 14:56:19 GMT
Author: dpfister
Date: Tue May  3 07:56:19 2005
New Revision: 167916

URL: http://svn.apache.org/viewcvs?rev=167916&view=rev
Log:
Resolution to issue #571: support for jcr:score as a function

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/query/OrderByTest.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java?rev=167916&r1=167915&r2=167916&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
Tue May  3 07:56:19 2005
@@ -127,6 +127,11 @@
     static final QName JCR_ROOT = new QName(Constants.NS_JCR_URI, "root");
 
     /**
+     * QName for jcr:score
+     */
+    static final QName JCR_SCORE = new QName(Constants.NS_JCR_URI, "score");
+
+    /**
      * String constant for operator 'eq'
      */
     private static final String OP_EQ = "eq";
@@ -817,6 +822,12 @@
                     } else {
                         exceptions.add(new InvalidQueryException("Unsupported location for
jcr:deref()"));
                     }
+                }
+            } else if (JCR_SCORE.toJCRName(resolver).equals(fName)) {
+                if (queryNode.getType() == QueryNode.TYPE_ORDER) {
+                    createOrderSpec(node, (OrderQueryNode) queryNode);
+                } else {
+                    exceptions.add(new InvalidQueryException("Unsupported location for jcr:score()"));
                 }
             } else {
                 exceptions.add(new InvalidQueryException("Unsupported function: " + fName));

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/query/OrderByTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/query/OrderByTest.java?rev=167916&r1=167915&r2=167916&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/query/OrderByTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/query/OrderByTest.java
Tue May  3 07:56:19 2005
@@ -46,7 +46,7 @@
         QueryResult result = q.execute();
         checkResult(result, 3);
 
-        String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by
@jcr:score, @value";
+        String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by
jcr:score(), @value";
         q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
         result = q.execute();
         checkResult(result, 3);



Mime
View raw message