Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Is it possible to search for a rendition of an image based on the dimensions via QueryBuilder API

Avatar

Level 1

Hi all,

 

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 search the image renditions?

Looking forward to your ideas!

1 Accepted Solution

Avatar

Correct answer by
Employee

You cannot do this OOTB since rendition dimensions are not sorted as properties.

 

Technically could search for rendition nt:files, create a custom QueryBuilderFiltering predicate that pulls them into memory and determines their size and filters them in/out - but needless to say this would be very very bad for performance -- so don't do this!

 

Instead, I suggest creating a WF Process (assuming 6.x) that determines and writes rendition sizes as JCR Properties that you can then search over. There are main places you could put this data:

1) on the rendition [dam:Asset]/renditions/[nt:file]/[oak:resource] node - however this would require a custom mixin to allow you to put these custom properties - however you could apply them on each discrete rendition node.

2) under [dam:Asset]/metadata in some structure that holds the rendition dimensions, along w/ the rendition name.

 

Then make sure these new properties are indexed - and then use query builder to query on these derived rendition size properties.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

You cannot do this OOTB since rendition dimensions are not sorted as properties.

 

Technically could search for rendition nt:files, create a custom QueryBuilderFiltering predicate that pulls them into memory and determines their size and filters them in/out - but needless to say this would be very very bad for performance -- so don't do this!

 

Instead, I suggest creating a WF Process (assuming 6.x) that determines and writes rendition sizes as JCR Properties that you can then search over. There are main places you could put this data:

1) on the rendition [dam:Asset]/renditions/[nt:file]/[oak:resource] node - however this would require a custom mixin to allow you to put these custom properties - however you could apply them on each discrete rendition node.

2) under [dam:Asset]/metadata in some structure that holds the rendition dimensions, along w/ the rendition name.

 

Then make sure these new properties are indexed - and then use query builder to query on these derived rendition size properties.