1

What I would like to achieve is the following. Based on the specified dimension and an asset title I would like to find all the asset renditions which correspond to the search criteria.

Currently, I am using the QueryBuilder API as I am not working in Java but it seems impossible that in just one call to the AEM I manage to get the wanted rendition.

What would be the best way for searching the image renditions?

Looking forward to your ideas!

1 Answers1

1

You can do with SQL2 JOIN query:

SELECT parent.* FROM [dam:AssetContent] AS parent INNER JOIN [nt:file] AS child ON ISDESCENDANTNODE(child,parent) WHERE ISDESCENDANTNODE(parent, '/content/dam') AND parent.[cq:name]='men_5.jpg' and name(child)='cq5dam.thumbnail.48.48.png'

parent looks for dam:AssetContent nodes with name=men_5.jpg and child looks for nt:file nodes under corresponding asset with nodename=cq5dam.thumbnail.48.48.png

Saravana Prakash
  • 1,321
  • 13
  • 25
  • Thank you for the response! Could you tell me as well is it possible to run this query via an HTTP API? – Roberto Baranzini Mar 30 '20 at 07:24
  • 1
    2 options: 1) run the query from crxde->tools->query; from network tab, you can pull query.jsp call. It returns json as expected. But this works only from author. 2) Using sling servlet to run query and return results -https://helpx.adobe.com/experience-manager/using/using-query-builder-servlet.html – Saravana Prakash Mar 30 '20 at 12:43
  • Can sling servlets be used from languages other than Java? – Roberto Baranzini Mar 31 '20 at 08:55
  • Oh I understood. You dont want to write java servlet. You are right to use QueryBuilder API and hit using curl; example: curl -s -u admin:admin GET "http://localhost:4502/bin/querybuilder.json?path=%2fcontent%dam%2fen&property=fileReference&property.value=%2fcontent%2fdam%2fgeometrixx%2fshapes%2ftri_equilateral.png&type=nt%3aunstructured". Issue is, it runs only XPath Queries. You ll need to run 2 Xpath queries and merge results at your end OR try some XPath Join queries. I am not sure how to join 2 xpath queries. – Saravana Prakash Apr 01 '20 at 01:01