Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Query[SQL/SQL2/Xpath/JCR] to be used to get the required data?

Avatar

Level 9

Hi All,

There are multiple pages in author under /content. Suppose each page has a property as below :

Name    Type      Value
Custom  String[]  old:asdf,old:qwer,new:hjkl

NOTE : There are hundreds of property values which starts with "old:" notation

Suppose, I want to find out all the pages, which has old:xxx[where xxx represents some value present]
as a value in 'Custom' property. 

Probably a query[JCR/Xpath/SQL/SQL2 has to be run to find this out]. Not sure which one is the most efficient here.

Can you please provide me with the query that can be used to find out the results.

Any thoughts on this will be really helpful.

1 Accepted Solution

Avatar

Correct answer by
Level 3

SQL2:

SELECT * FROM [nt:unstructured] WHERE ISDESCENDANTNODE('/content') AND Custom = 'old:xxx'

View solution in original post

3 Replies

Avatar

Correct answer by
Level 3

SQL2:

SELECT * FROM [nt:unstructured] WHERE ISDESCENDANTNODE('/content') AND Custom = 'old:xxx'

Avatar

Level 9

Hi Jura,

Thank you for your reply.

Avatar

Level 9

Hi All,

Can you please let me know which is more efficient of the below two queries.

SELECT * FROM [nt:unstructured] WHERE ISDESCENDANTNODE('/content') AND CONTAINS(Custom, 'old:')


SELECT * FROM [nt:unstructured] WHERE ISDESCENDANTNODE('/content') AND Custom like 'old:%'