Skip to main content
Level 2
Aug 28, 2023 11:39 AM UTC

Is it possible to query Javascript files in AEM DAM?

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

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

5 replies

kaikubad
Community Advisor
Community Advisor
Aug 28, 2023 11:49 AM UTC

Hi @nitishchawla ,

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')
Translate
mkaikubad
Level 2
Aug 28, 2023 12:30 PM UTC

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')


Thanks,

Nitish

Translate
aanchal-sikka
Community Advisor
Community Advisor
Aug 28, 2023 12:52 PM UTC

Hello @nitishchawla 

 

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

Translate
Aanchal Sikka
Level 2
Aug 28, 2023 12:58 PM UTC

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

 

Thanks,

Nitish

Translate