Query to get all referenced assets from a specific page path | Community
Skip to main content
touseefk2181136
Level 3
June 16, 2023
Solved

Query to get all referenced assets from a specific page path

  • June 16, 2023
  • 2 replies
  • 1994 views

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.

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

@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

 

 

2 replies

Shashi_Mulugu
Community Advisor
Community Advisor
June 18, 2023
Jagadeesh_Prakash
Community Advisor
Jagadeesh_PrakashCommunity AdvisorAccepted solution
Community Advisor
June 19, 2023

@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