I am newbie in Adobe Experience Manager. I am working on Query Builder. Here down is my query which is tried by me to search all node properties of container_copy
node.
path=/content/pojoName/au/en/enquiry-form
type=cq:PageContent
1_property=jcr:content/root/container/container/container_copy
1_property.operation=exists
2_property=jcr:content/root/container/container/container_copy
2_property.value=singleText
Here down is the snapshot of my page in CRXDE
You do not need to search for type=cq:PageContent
. You can search for a sling:resourceType
property for a targeted node. Since every component in CRX will have this property
If you need to find necessary nodes only under /content/pojoName/au/en/enquiry-form
use direct path. More global pass may be used to find components in more global area like /content/pojoName/au/en/
Just use the sling:resourceType
of container_copy
component.
path=/content/pojoName/au/en/enquiry-form
1_property=sling:resourceType
1_property.value=PUT_VALUE_HERE
If you need properties of child nodes, just iterate through the child element and get properties.
Map map = new HashMap();
map.put("path", "/content");
map.put("1_property", "sling:resourceType");
map.put("1_property.value", "/resource/type/of/node");
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult result = query.getResult();
//get properties of container_copy
Optional.ofNullable(result.getResources)
.forEach(r -> r.getValueMap())
......
//get properties of container_copy children
Optional.ofNullable(result.getResources)
.forEach(r -> r.getChildren())
.forEach(r -> r.getValueMap())
......