[ 
https://issues.apache.org/jira/browse/OAK-6792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201738#comment-16201738
 ] 

Thomas Mueller commented on OAK-6792:
-------------------------------------

Proposed patch (just tests the conversion; more tests are needed):

{noformat}
### Eclipse Workspace Patch 1.0
#P oak-core
Index: src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt
===================================================================
--- src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt        
(revision 1811333)
+++ src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt        
(working copy)
@@ -24,6 +24,14 @@
 # * new tests are typically be added on top, after the syntax docs
 # * use ascii character only
 
+# OAK-6792
+
+xpath2sql /jcr:root//*/(rep:facet(jcr:createdBy))
+select [jcr:path], [jcr:score], [rep:facet(jcr:createdBy)]
+  from [nt:base] as a
+  where isdescendantnode(a, '/')
+  /* xpath ... */
+
 # OAK-6778
 
 xpath2sql explain /jcr:root/content/(activities|people)//element(*, acme:Asset)
@@ -31,7 +39,7 @@
   from [acme:Asset] as a
   where isdescendantnode(a, '/content/activities')
   /* xpath ... */
-  
+ 
 xpath2sql explain measure /jcr:root/content/(activities|people)//element(*, 
acme:Asset)
 explain measure select [jcr:path], [jcr:score], *
   from [acme:Asset] as a
Index: 
src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
===================================================================
--- 
src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java   
    (revision 1811333)
+++ 
src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java   
    (working copy)
@@ -234,6 +234,13 @@
                         rewindSelector();
                         Expression.Property p = new 
Expression.Property(currentSelector, "rep:excerpt", false);
                         statement.addSelectColumn(p);
+                    } else if ("rep:facet".equals(identifier)) {
+                        String property = readIdentifier();
+                        read(")");
+                        rewindSelector();
+                        Expression.Property p = new 
Expression.Property(currentSelector, 
+                                        "rep:facet(" + property + ")", false);
+                        statement.addSelectColumn(p);
                     } else {
                         throw getSyntaxError();
                     }
{noformat}

> rep:facet not supported in xpath
> --------------------------------
>
>                 Key: OAK-6792
>                 URL: https://issues.apache.org/jira/browse/OAK-6792
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: query
>            Reporter: Vikas Saurabh
>
> Parsing
> {noformat}
> //element(*, app:Asset)/(rep:facet(jcr:createdBy))
> {noformat}
> gives following exception.
> {noformat}
> Caused by: java.text.ParseException: Query:
> /jcr_root//element(*, app:Asset)/rep:facet(jcr:createdBy(*))
> {noformat}
> /cc [~tmueller]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to