我想在CQ5.6 (AEM)实例中包含的JCR存储库中搜索包含给定字符串xxx的所有.jsp文件。作为JCR对XPath (或JCR-SQL2)解释的新手,我在表达查询方面并不是很成功。
这将为我获取所有.jsp文件:
//*[jcr:contains(., '.jsp')]这就是我希望限制包含xxx的上述.jsp文件列表的方式
//*[jcr:contains(., '.jsp')][jcr:contains(jcr:content/@jcr:data, 'xxx')]
//*[jcr:contains(., '.jsp') and jcr:contains(jcr:content/@jcr:data, 'xxx')]
//*[jcr:contains(., '.jsp')]/jcr:content[jcr:contains(@jcr:data, 'xxx')]/..类型为Binary的@jcr:data。以上这些似乎都不管用。我哪里错了?
发布于 2013-04-24 21:10:49
看起来查询应该在nt:file节点上,而不是在jcr:data节点上。请参阅对JCR - Jackrabbit - Xpath expression for search content text of a file contained inside a node的回答。
使用querybuilder的快速测试显示来自CQ中的JSP文件的结果(在此示例中,它们包含"/foundation/global.jsp"):
http://localhost:4502/bin/querybuilder.json?type=nt:file&nodename=*.jsp&group.1_fulltext=foundation/global.jsp提供:
{
success: true,
results: 10,
total: 21,
offset: 0,
hits: [
{
path: "/libs/cq/personalization/components/offerpage/body.jsp",
excerpt: " --%><%@include file="/libs/<strong>foundation/global.jsp</strong>"%><% I18n i18n = new I18n(slingRequest); String icnCls = ...",
name: "body.jsp",
title: "body.jsp",
lastModified: "2013-04-24 11:45:05",
created: "2013-04-24 11:32:58",
size: "3 KB",
mimeType: "text/plain"
},
...
}https://stackoverflow.com/questions/16191395
复制相似问题