AEM6.3_Auto Xpath Query Or SQL Query Generation or Query Builder to XPath generation


Solution :
Query Builder API to Xpath Query conversion

  1. Go to this path : http://localhost:4502/libs/cq/search/content/querydebug.html

  2. This tool is used to perform search queries on JCR
  3. For Example - Search all assets under /content/dam folder
  4. Use the below query : 
  5.                     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

  1. Go to this path : /crx/explorer/ui/search.jsp?Path=&Query=%2fjcr%3aroot%2fcontent%2f%2f*
  2. Enter Search for = men & Search in = /content and choose the option in which query to be searched SQL or XPath
  3. 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 

  4. Or choose option SQL it equivalent SQL query will be generated : /jcr:root/content//*[jcr:contains(., 'men')] order by @jcr:score descending
  5. 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 specifiv version of files.

No comments:

Post a Comment