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

Vikas Saurabh commented on OAK-6792:
------------------------------------

[~tmueller], backporting to 1.4 didn't work out for me. What instead did work 
was:
{noformat}
Index: 
oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
===================================================================
--- 
oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
      (revision 1814026)
+++ 
oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
      (working copy)
@@ -247,6 +247,21 @@
                         readOpenDotClose(true);
                         Expression.Property p = new 
Expression.Property(currentSelector, "rep:suggest()", false);
                         statement.addSelectColumn(p);
+                    } else if (readIf("rep:facet")) {
+                        // this will also deal with relative properties
+                        // (functions and so on are also working, but this is 
probably not needed)
+                        read("(");
+                        Expression e = parseExpression();
+                        if (!(e instanceof Expression.Property)) {
+                            throw getSyntaxError();
+                        }
+                        Expression.Property prop = (Expression.Property) e;
+                        String property = prop.getColumnAliasName();
+                        read(")");
+                        rewindSelector();
+                        Expression.Property p = new 
Expression.Property(currentSelector,
+                                "rep:facet(" + property + ")", false);
+                        statement.addSelectColumn(p);
                     }
                 } while (readIf("|"));
                 read(")");
{noformat}
It's essentially the same way we are parsing the expression - just at a 
different place. Would this be preferable? If so, should I do this on trunk and 
1.6 too?

> 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
>            Assignee: Vikas Saurabh
>            Priority: Major
>              Labels: candidate_oak_1_4
>             Fix For: 1.8, 1.7.10, 1.6.7
>
>
> 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