使用SQL2在多个路径中搜索内容的查询字符串

时间:2012-11-27 16:16:28

标签: cq5 jcr-sql2

目前,我遇到了问题,无法生成具有多个路径的查询。我可以完成从crx存储库中的特定根路径搜索子节点的情况。我使用了关键字isdecendantnodenode()

select * from [nt:base] as p
where
   (isdescendantnode (p, [first path])) 
   and contains(p.*, '"bankproducts"')
   and p.[sling:resourceType] = 'components/content/download'

正如我所说,这样做很好。现在,我必须面对挑战,搜索出现在两个或更多不同子节点中的元素 - 在同一层次结构级别。

我的目标是:

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'

这只给了我回来的元素,他们只在第二条道路上(在我看来)。

下一个示例导致存储库异常:

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'

可能关键字的顺序错误。我没有想法所以SO属于我最后的选择。

提前致谢

1 个答案:

答案 0 :(得分:0)

在路径条件中使用“OR” - (isdescendantnode (p, [first path]) or isdescendantnode(p, [second path]))

相关问题