We are facing an issue with sorting using the query builder API in AEM 6.1.
We have a query where sorting happens based on a custom(not cq default) and this does not work at all in AEM 6.1, while sorting with a cq default property works.
orderby=@jcr:content/newOrder -----> this does not work
orderby=@jcr:content/jcr:title -----------> this works
Has anyone faced this issue earlier or know the fix for this ? Please help.
Views
Replies
Total Likes
Hi
Please have a look this post:-
Documentation :- https://docs.adobe.com/docs/en/aem/6-1/develop/search/querybuilder-api.html
//
map.put("orderby", "@created");
map.put("orderby.sort", "desc"); // in case you want it descending
In case you need to check property within a child node, you can provide the relative path to that for the orderby value. For eg., if you are searching for dam:Asset and want to order them based on the jcr:lastModified property of its metadata, then your query would be something similar to this.
map.put("path", "/content/dam/geometrixx");
map.put("type", "dam:Asset");
map.put("orderby","@jcr:content/metadata/jcr:lastModified");
Link:- http://adobeaemclub.com/multiple-order-by-clause-querybuilder-in-aem-aka-cq5/
For Query Builder Tutorial:- https://hashimkhan.in/aem-adobecq5-code-templates/query-builder/
I hope this would help you.
Thanks and Rehards
Kautuk Sahni
Views
Replies
Total Likes
Hi Kautuk,
Thanks for your reply. But I think you got my question wrong. I am aware of how the orderby predicate works :)
Let me re-phrase my issue.
This query works well in 6.0. The issue is with 6.1 only.
Hi,
orderby works fine in AEM 6.1 with custom property, i remember using it recently in one implementation. Not sure if its a bug as I was having SP1 installed and worked perfect
Can you share complete query or make sure generated xpath query is proper.
Thanks
Try JCR SQL2 to order and let us know if that works or issue is still there:
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies