Author: catholicon
Date: Sun Nov 5 02:21:34 2017
New Revision: 1814332
URL: http://svn.apache.org/viewvc?rev=1814332&view=rev
Log:
OAK-6792: rep:facet not supported in xpath
Earlier fix didn't work with 1.4 backport. So, doing this change which
should work fine across trunk, 1.6 and 1.4. Also, this seems like a
preferable approach to parse.
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java?rev=1814332&r1=1814331&r2=1814332&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
Sun Nov 5 02:21:34 2017
@@ -234,20 +234,6 @@ public class XPathToSQL2Converter {
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();
}
@@ -280,6 +266,21 @@ public class XPathToSQL2Converter {
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("|"));
if (!readIf(")")) {