[
https://issues.apache.org/jira/browse/OAK-6792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201772#comment-16201772
]
Thomas Mueller commented on OAK-6792:
-------------------------------------
New patch to support relative properties:
{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,21 @@
# * new tests are typically be added on top, after the syntax docs
# * use ascii character only
+# OAK-6792
+
+xpath2sql /jcr:root//*/(rep:facet(jcr:data/jcr:createdBy))
+select [jcr:path], [jcr:score], [rep:facet(jcr:data/jcr:createdBy)]
+ from [nt:base] as a
+ where isdescendantnode(a, '/')
+ /* xpath ... */
+
+
+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 +46,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,20 @@
rewindSelector();
Expression.Property p = new
Expression.Property(currentSelector, "rep:excerpt", false);
statement.addSelectColumn(p);
+ } else if ("rep:facet".equals(identifier)) {
+ // this will also deal with relative properties
+ // (functions and so on are also working, but this is
probably not needed)
+ 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);
} 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)