Hi,
I'm looking to retrieve child nodes of a parent node based on their resourcetype. So for exampe, i have a tabs component on my page and i want to retrieve the child accordions out of the tabs. I actually have this query:
type=nt:unstructured
path=/content/path/to/my/page
p.limit=-1
p.hits=full
1_property=sling:resourceType
1_property.value=qt/components/content/tabs
p.nodedepth=4
This query returns the tabs and their child components (thanks to nodedepth). But the best for me would be to refine the query to only get a collection of accordions. I don't need the tabs, I only need the accordions located into the tabs. Is there a way to do this?
Thanks for the help!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @dartoism-inetum,
We can make use of JCR-SQL2 query for this use case.
Assumption : Content structure is tabs -> items[1..n]responsivegrid -> accordion.
If your content structure is deviating from the assumption, please share the same. We can amend the query accordingly.
select c.* from [nt:unstructured] as a inner join [nt:unstructured] as b on ischildnode(b,a) inner join [nt:unstructured] as c on ischildnode(c, b) where isdescendantnode(a, '/content/demo')
and a.[sling:resourceType]='demoproject/components/content/tabs'
and b.[sling:resourceType]='wcm/foundation/components/responsivegrid'
and c.[sling:resourceType]='demoproject/components/content/accordion'
Views
Replies
Total Likes
@dartoism-inetum Please check below community thread:
Views
Replies
Total Likes
Hi @Bhuwan_B,
Thank you for your quick reply. I might be wrong but i don't think this will do the trick. It looks more about path filtering. I would like to have the child nodes of a parent node based on child's resourceType value. Something like this (which is wrong of course):
type=nt:unstructured
path=/content/path/to/my/page
p.limit=-1
p.hits=full
1_property=sling:resourceType
1_property.value=qt/components/content/accordion
1_with_parent_property=sling:resourceType
1_with_parent_property.value=qt/components/content/tabs
I'm not very familiar with such queries. if you think it can be done can you propose something based on the above code? Thanks!
Views
Replies
Total Likes
Hi @dartoism-inetum,
We can make use of JCR-SQL2 query for this use case.
Assumption : Content structure is tabs -> items[1..n]responsivegrid -> accordion.
If your content structure is deviating from the assumption, please share the same. We can amend the query accordingly.
select c.* from [nt:unstructured] as a inner join [nt:unstructured] as b on ischildnode(b,a) inner join [nt:unstructured] as c on ischildnode(c, b) where isdescendantnode(a, '/content/demo')
and a.[sling:resourceType]='demoproject/components/content/tabs'
and b.[sling:resourceType]='wcm/foundation/components/responsivegrid'
and c.[sling:resourceType]='demoproject/components/content/accordion'
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies