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

SOLVED

AEM QueryBuilder API: Is it possible to query based on parent property?

Avatar

Level 4

 

I have a hierarchy of content fragment as follows:

 

article-name

-- jcr:content

---- data

------ master

------ variation-1

 

data has following properties:

 

`cq:model`:"/conf/settings/dam/cfm/models/articles"

`jcr:PrimaryType`:"nt:unstructured"

 

Now my question is if my master query looks like this:

 

```

type=nt:unstructured
path=/content/dam/articles
p.hits=selective
nodename=master
p.properties=author featuredImage

```

 

and I want to add one more filter with parent_node property value as:

 

```

type=nt:unstructured
path=/content/dam/articles
p.hits=selective
nodename=master
p.properties=author featuredImage

parent.property=cq:Model

parent.property.value=/conf/settings/dam/cfm/models/articles

```

 

what would be the syntax for that ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @spidey1405,

I think that the simplest option, will be to use relative path the parent node from which you would like to read property values. Assuming you wanted to use cq:model property value that is stored under data node, and get all master variation, you can try something like that.

type=nt:unstructured
path=/content/dam
property=../../../jcr:content/data/cq:model
property.value=/conf/we-retail/settings/dam/cfm/models/we-retail-experience
nodename=master

You can also implement custom predicate evaluator:

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @spidey1405,

I think that the simplest option, will be to use relative path the parent node from which you would like to read property values. Assuming you wanted to use cq:model property value that is stored under data node, and get all master variation, you can try something like that.

type=nt:unstructured
path=/content/dam
property=../../../jcr:content/data/cq:model
property.value=/conf/we-retail/settings/dam/cfm/models/we-retail-experience
nodename=master

You can also implement custom predicate evaluator: