0

I want identical XPATH query to trhis SQL2 Query.

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/abc/def]) and ([sling:resourceType] = 'geomatrixx/components/list' )

Is there any tool or link available through which i can convert sql2 query into xpath. or any tutorial if yes then please share the link

Markus
  • 452
  • 3
  • 12
user2142786
  • 1,484
  • 9
  • 41
  • 74
  • 2
    The only way I know is with code. If you use the com.day.cq.search.Query class you see the used xpath query in the debugger of the IDE after the method getResult() is called... – Thomas Jun 25 '15 at 13:33

1 Answers1

2

Below is the equilvalent XPath query.

    /jcr:root/content/abc/def//element(*, cq:Page)[jcr:contains(jcr:content/@sling:resourceType, 'geometrixx/components/list')].

Below are some of the mappings between xpath and sql2 queries respectively.Taken from http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html.

      //*                                                SELECT * FROM [nt:base]
      //element(*,my:type)                               SELECT * FROM [my:type]
     //element(*,my:type)/@my:title                      SELECT [my:title] FROM [my:type]
     //element(*,my:type)/(@my:title | @my:text)         SELECT [my:title],[my:text] FROM [my:type]
    //element(*,my:type)/(@my:title union @my:text)      SELECT [my:title],[my:text] FROM [my:type]

Thanks, Balaji

balaji
  • 774
  • 1
  • 16
  • 42