AEM6.3_How to use SQL2 & Xpath Query Tool

Statement - How to use SQL2 & Xpath Query Tool in AEM

Environment - AEM 6.3

Solution -



  1. Go to this path http://localhost:4502/crx/explorer/ui/search.jsp?Path=&Query= 
  2. User can enter the SQL query or Xpath Query for the search
          Xpath Query : to find a node of givn type
                         1. //element(*, dam:Asset)





  SQL Query : To find a node of givn type
2. select * from [dam:Asset] as cm


Sample Queries :


1. Find all the string contains “Men” under /content

XPath:
/jcr:root/content//element(*)[jcr:contains(@*, 'men’)]

SQL:

SELECT * from [nt:base] AS t
where ISDESCENDANTNODE('/content') and
      contains(t.*, ‘men’)

Query Builder API :

path=/content
fulltext=men



2. Find all nodes under /content created in the past month

XPath:

/jcr:root/content//*
[
((@jcr:created > xs:dateTime('2018-04-22T15:23:57.313Z')
and @jcr:created < xs:dateTime('2018-05-22T15:23:57.313Z')))
]

SQL:

select * from [nt:base] as a
where [jcr:created] > cast('2018-05-22T07:24:50.233Z' as date) and
      [jcr:created] < cast('2018-05-22T07:24:50.233Z' as date) and
      isdescendantnode(a, '/content')

Query Builder:

path=/content
1_relativedaterange.property=jcr:created
1__relativedaterange.lowerBound=-1M
1_relativedaterange.upperBound=0

No comments:

Post a Comment