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.

Is it possible to query Javascript files in AEM DAM?

Avatar

Level 2

I want to search for a keyword in Javascript files that exists as DAM file in AEM. Javascript are saved as nt:file and data resides in jcr:data, is it possible to search for a keyword in these? With xPath or SQL2? Any other options for suggestions?

 

Thank you,

Nitish

5 Replies

Avatar

Community Advisor

Hi @j408 ,

Yes, you can search for a keyword in JavaScript files that are saved as DAM  files in AEM. AEM provides querying capabilities using XPath and SQL2 . However, as of my knowledge SQL2 is the more recommended approach for querying JCR nodes including DAM assets. XPath is supported but might have limitations and could be less efficient for complex queries. The query will be something like this 

SELECT * FROM [nt:file] AS file
WHERE ISDESCENDANTNODE(file, '/content/dam/example')
AND CONTAINS(file.*, 'your_keyword')

Avatar

Level 2

Hi,

 

Thank you for your response.

 

We have tried that, but it is giving no results.

SELECT * FROM [nt:file] AS file WHERE ISDESCENDANTNODE(file, '/content/dam/ph/page%20embedded/') AND CONTAINS(file.*, 'emailURL')

j408_0-1693225740525.png


Thanks,

Nitish

Avatar

Community Advisor

Hello @j408 

 

I am able to find the asset with following query

path=/content/dam
fulltext=rootpath
type=dam:Asset

 

damAssetLucene considers "jcr:content/renditions/original" for aggregates. Thus, indexing the data in original rendition


Aanchal Sikka

Avatar

Level 2

Hi @aanchal-sikka,

 

Thank you for this.

 

I have already tried this in QueryBuilder, but it is not behaving as expected. I am using 6.5.13.

path=/content/dam/...
fulltext=my_keyword
type=dam:Asset

j408_0-1693227393212.png

 

Thanks,

Nitish