orderby.sort value not being reflected in generated xpath
I'm having differing results when running a query via the query builder and via a component building the same query, mainly on the order of the results. Setting orderby.sort = desc in the query builder gives me exactly as I would expect, in this case ordering results by publication date starting with the most recent. However, when I add the exact same predicate to a query inside a component, the xpath that gets generated is missing the "descending" at the end and thus the results are order in ascending order.
The snippet that adds the orderby.sort predicate:
.set( "orderby.sort", request.getResource().getValueMap().get( "sortOrder", String.class ) );
The component in question is based largely on the Core List v4, so the possible values of the sortOrder property are "asc" and "desc", which should line up with possible values for the same predicate in the query builder.
The xpath that results from the query builder is
/jcr:root/content/[site-root]//element(*, cq:Page) [(jcr:content/@cq:tags = '[tag-path]')] order by jcr:content/@pubdate descending
result.getQueryStatement() inside the component returns
/jcr:root/content/[site-root]//element(*, cq:Page)[(jcr:content/@cq:tags = '[tag-path]')]/rep:excerpt(.) order by jcr:content/@pubdate
For some reason, the orderby.sort=desc doesn't get picked up even though I both see it as a predicate on the SimpleSearch before it is run and the other sorting predicate, orderby, is added in the same line as orderby.sort and takes effect as expected.


