Use 'OR' in the path condition -- (isdescendantnode (p, [first path]) or isdescendantnode(p, [second path]))
.
Querystring for searching content in several paths, using SQL2
Question
Currently I am stuck at the issue to generate a query with multiple paths. I could accomplish the situation searching for childnodes from a specific single rootpath in the crx repository. I use the keyword isdecendantnodenode()
for that:
select * from [nt:base] as p
where
(isdescendantnode (p, [first path]))
and contains(p.*, '"bankproducts"')
and p.[sling:resourceType] = 'components/content/download'
As I said this works fine. Now I have to face the challenge searching for elements that does appear in two or more different childnodes - in the same hierarchy level.
My attempts to achieve that are following:
select * from [nt:base] as p
where
(isdescendantnode (p, [first path]) and isdescendantnode(p, [second path]))
and contains(p.*, '"bankproducts"')
and p.[sling:resourceType] = 'components/content/download'
This gives me only the elements back they are only in the second path (in my eyes).
The next example results into a repository exception:
select * from [nt:base] as p
where
(isdescendantnode (p, ([first path] and [second path]))
and contains(p.*, ' "bankproducts"')
and p.[sling:resourceType] = 'components/content/download'
May the order of keywords are wrong. I run out of ideas so SO belongs to the last options I've got.
Thanks in advance
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow