Expand my Community achievements bar.

SOLVED

Query to get all referenced assets from a specific page path

Avatar

Level 3

I need an AEM query to get all the assets which are being used by pages in the path /content/mycompany/companycom/en/legal-contacts. I don't want to write code, I am looking to handle this via query itself.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@touseefk2181136 Try below query in Query builder

 

map.put("path", path); // The path where you want to search (e.g., "/content/mysite")

map.put("type", "dam:Asset"); // The node type you want to retrieve (e.g., dam:Asset)

map.put("1_property", "jcr:content/cq:tags"); // Property to check for tags (optional, remove if not needed)

map.put("1_property.operation", "exists"); // Operator for the property check (optional, remove if not needed)

map.put("2_property", "jcr:content/renditions/original/jcr:content/jcr:lastModified"); // Property to check for last modified date (optional, remove if not needed) map.put("2_property.operation", "exists"); // Operator for the property check (optional, remove if not needed)

map.put("orderby", "@jcr:content/jcr:lastModified"); // Order the results by last modified date (optional, remove if not needed)

 

http://localhost:4502/libs/cq/search/content/querydebug.html

 

 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@touseefk2181136 Try below query in Query builder

 

map.put("path", path); // The path where you want to search (e.g., "/content/mysite")

map.put("type", "dam:Asset"); // The node type you want to retrieve (e.g., dam:Asset)

map.put("1_property", "jcr:content/cq:tags"); // Property to check for tags (optional, remove if not needed)

map.put("1_property.operation", "exists"); // Operator for the property check (optional, remove if not needed)

map.put("2_property", "jcr:content/renditions/original/jcr:content/jcr:lastModified"); // Property to check for last modified date (optional, remove if not needed) map.put("2_property.operation", "exists"); // Operator for the property check (optional, remove if not needed)

map.put("orderby", "@jcr:content/jcr:lastModified"); // Order the results by last modified date (optional, remove if not needed)

 

http://localhost:4502/libs/cq/search/content/querydebug.html