Hi,
I want to use query builder to search the siblings of a page node in CQ. For this what i am doing is to get the parent of the page, then use that in the path attribute of the predicate and run the search. But this search is not only returning me the siblings of the page but it is also returning me the child page nodes of the siblings. I tried using p.nodedepth but that did not help.
Can you suggest me how I can achieve this? Let me give an example:
Lets us assume this is my node structure:
a
1, 2, 3
b
1,2,3
c
1,2,3
Here a, b, c are siblings and 1,2,3 are children of the siblings. I should not get the children in the results and I should get only a,b and c in the result.
This is the predicate i use:
path=/content/B2B_HC/en_US/specialties-catalog/
type=cq:Page
p.hits=full
p.nodedepth=1
Is there something wrong here?
Regards,
Yadhu
Solved! Go to Solution.
Views
Replies
Total Likes
Hiya, just a thought. Is there a reason you need to search for it ?
<% Iterator<Page> pageChildren = myPage.listChildren(new PageFilter(request)); %>
would work in just the same way that you want your search to do it and it would be less to write as well.
Regards
/Johan
Views
Replies
Total Likes
Hiya, just a thought. Is there a reason you need to search for it ?
<% Iterator<Page> pageChildren = myPage.listChildren(new PageFilter(request)); %>
would work in just the same way that you want your search to do it and it would be less to write as well.
Regards
/Johan
Views
Replies
Total Likes
What Johan has said above is right. If you still want to use search query then you can something like this using xpath query :
/jcr:root/content/geometrixx/en/element(*, cq:Page)
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies