Is it possible to query Javascript files in AEM DAM? | Community
Skip to main content
Level 2
August 28, 2023

Is it possible to query Javascript files in AEM DAM?

  • August 28, 2023
  • 3 replies
  • 1269 views

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.

3 replies

kaikubad
Community Advisor
Community Advisor
August 28, 2023

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')
Level 2
August 28, 2023

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

aanchal-sikka
Community Advisor
Community Advisor
August 28, 2023

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

Aanchal Sikka
Level 2
August 28, 2023

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