Expand my Community achievements bar.

SOLVED

In the AEM Query Builder API is it possible to query the properties of a related resource?

Avatar

Level 4

We have some code in AEM that currently allows us to search a folder of content fragments and then interrogate nested content fragments based on their jcrName.

 

So, take for example a CF named "FAQ". And that fragment has a related fragment named "Question Type". We can search for FAQs with a Question Type like "Day of the procedure".

 

In GraphQL currently we can search the field questionType and ask if the jcrName matches "day-of-the-procedure" even if what's actually set in JCR is the path to the questionType fragment.

 

I'm struggling to figure out how to do something similar in Query Builder outside of either using SQL2 or making an initial query that retrieves the jcrName values from the questionType fragment.

 

Am I missing something?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Preston you can't do that with one single Query, you have to go with nested queries powered by api to fetch nested cf objects in between.

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

@Preston you can't do that with one single Query, you have to go with nested queries powered by api to fetch nested cf objects in between.

Avatar

Community Advisor

@Preston When you say "jcrName", do you neam node name or am I missing something?

If its nodename validation, then a query like this might help

type=dam:Asset
path=/content/dam/wknd-shared
property=jcr:content/data/master/primaryImage
property.value=%adobestock-175749320.jpg
property.operation=like

 But, if we need to query based on the data inside the referenced asset, then you might have to either validate the result individually using Content Fragment API or nested queries(haven't tried nested myself)


Aanchal Sikka

Avatar

Level 4

We have a field called "jcrName", so that nested field based on jcrName and not the value itself. The value itself being the path.