本文介绍了通过Java在JCR回购中进行递归搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在 JCR JCR SQL2查询.

但是,在某些情况下,我想使用Java,使用 JCR API :javax.jcr.Nodejavax.jcr.NodeIterator等.

However, I would like to use Java in certain cases, using the JCR API: javax.jcr.Node, javax.jcr.NodeIterator and the like.

恐怕我会简单地编写自己的代码来重新发明轮子.

I'm afraid I will simply reinvent the wheel by coding my own.

是否已经有可用的内容(GistGithubelse)?

Is there anything already available (Gist, Github or else)?

推荐答案

您可以为此 SlingQuery .它受到jQuery的启发并遵循其语法.您应该仅使用它来搜索少量节点(最好是在100个以下),因为遍历查询的速度很慢.

You can use for that SlingQuery. It's inspired by jQuery and follows it's syntax. You should use it only to search small number of nodes (in best case under 100), because traversal queries are slow.

修改

您的示例可能会转换为以下SlingQueries(未经测试):

Your example may be converted to the following SlingQueries (not tested):

SlingQuery.$(startResource).find("[name=teasers][title=awesome-teaser]")

SlingQuery.$(startResource).find("[name][controlName]")

SlingQuery是 Apache Sling 的一部分,为什么github仓库似乎被废弃了.

SlingQuery is part of Apache Sling since a while, that's why the github repository seems to be abandoned.

注意:您可以以$(resource).find("...");之类的语法静态导入美元符号,并通过SlingQuery删除静态访问权限.

Note: You can static import the Dollar sign and drop the static access over SlingQuery in your syntax such as $(resource).find("...");

这篇关于通过Java在JCR回购中进行递归搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 04:55