April 23, 2020
Estimated Post Reading Time ~

AEM6.3 Auto XPath Query or SQL Query Generation or Query Builder to XPath generation

Solution:
Query Builder API to Xpath Query conversion
Go to this path: http://localhost:4502/libs/cq/search/content/querydebug.html

This tool is used to perform search queries on JCR
For Example - Search all assets under /content/dam folder
Use the below query : type= dam:Asset

path=/content/dam




Equivalent XPath Query: /jcr:root/content/dam//* as shown in the above screenshot.Auto Generation of SQL and Xpath Query Based on the Search in and Search for Parameter

Go to this path : /crx/explorer/ui/search.jsp?Path=&Query=%2fjcr%3aroot%2fcontent%2f%2f*

Enter Search for = men & Search in = /content and choose the option in which query to be searched SQL or XPath
choose option SQL it equivlent SQL query will be generated : select * from nt:base where jcr:path like '/content/%' and contains(*, 'men') order by jcr:score desc


Or choose option SQL it equivalent SQL query will be generated : /jcr:root/content//*[jcr:contains(., 'men')] order by @jcr:score descending


Enter for search in and search for auto query will be generated in the SQL or Xpath based on the selection. That's it!.

Advantages:
1. Help to quickly search full-text or component, page...etc details in the repository for specific path and search specific version of files.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.