This is an automated email from the ASF dual-hosted git repository. thomasm pushed a commit to branch OAK-9625 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 50e816e4f40b8c7bae701f4b818d16c89aba6a63 Author: thomasm <[email protected]> AuthorDate: Wed Nov 24 15:16:53 2021 +0100 OAK-9625 Support ordered index for first value of a multi-valued property, node name, and path --- .../apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java | 7 +++++++ .../src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java index c2d7b62..4182f4d 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java @@ -724,6 +724,13 @@ public class XPathToSQL2Converter { Expression.Cast c = new Expression.Cast(expr, "date"); read(")"); return c; + } else if ("fn:coalesce".equals(functionName)) { + Expression.Function f = new Expression.Function("coalesce"); + f.params.add(parseExpression()); + read(","); + f.params.add(parseExpression()); + read(")"); + return f; } else if ("jcr:first".equals(functionName)) { Expression.Function f = new Expression.Function("first"); f.params.add(parseExpression()); diff --git a/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt b/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt index 900200e..d24b313 100644 --- a/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt +++ b/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt @@ -29,9 +29,9 @@ xpath2sql /jcr:root/content//element(*, nt:base)[fn:path() >= $lastValue] order by fn:path() select [jcr:path], [jcr:score], * from [nt:base] as a - where path() >= @lastValue + where path(a) >= @lastValue and isdescendantnode(a, '/content') - order by path() + order by path(a) /* xpath ... */ xpath2sql /jcr:root/content//element(*, nt:base)[jcr:first(@vanityPath) >= $lastValue] order by jcr:first(@vanityPath), @jcr:path
