Need SQL2 query for AEM 6.2 | Community
Skip to main content
thiszparveen
Level 2
December 16, 2016

Need SQL2 query for AEM 6.2

  • December 16, 2016
  • 1 reply
  • 6732 views

Hi,

Please help me in writing SQL2 query to search for all the pages containing custom component property.

I have custom "bodycopy" component which has a property called "myproperty". Below are the sample paths. 

Conditions:
I can have any number of bodycopy components in "head-parsys" and at any level.
Fulltext search
Query should be performed on cq:Page

/content/mysite/jcr:content/head-parsys/bodycopy
/content/mysite/jcr:content/head-parsys/bodycopy_0
/content/mysite/jcr:content/head-parsys/parsys_1/bodycopy
/content/mysite/jcr:content/head-parsys/parsys_1/bodycopy_0

Below is the sample: 

select * from [cq:Page] as a where contains([dynamic/path/to/mycomponent/myproperty],'test') and isdescendantnode(a, '/content/mysite')

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

smacdonald2008
Level 10
December 16, 2016

What is the result set of this query?

thiszparveen
Level 2
December 16, 2016

CQ:Page

SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE([/content/mysite]) and CONTAINS(s.[jcr:content/head-parsys/mycomponent/myproperty], 'test') - Working

"head-parsys/mycomponent" is dynamic and can be of any levels. when I replace the values with * also not working

SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE([/content/mysite]) and CONTAINS(s.[jcr:content/*/*/myproperty], 'test') - Not Working in AEM 6.2. 

smacdonald2008
Level 10
December 16, 2016