AEM QueryBuilder API: Is it possible to query based on parent property? | Community
Skip to main content
Level 4
September 16, 2022
Solved

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

  • September 16, 2022
  • 1 reply
  • 1289 views

 

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 ?

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 lukasz-m

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:

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
September 16, 2022

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: