如何在 xwiki 中检查包含 1 个以上标签的文档? [英] How do I check for documents with more than 1 Tag in xwiki?
问题描述
所以我想访问所有使用 2 个标签而不是一个标签的文档.例如,我想要所有 photoshop 教程文档.如果我使用标签教程进行搜索,我也会得到其他软件教程,如果我使用标签 photoshop,我会得到所有文档,而不仅仅是教程.我应该能够提供 2 个标签并获取标有这两个标签的文档.
So I want to access all the documents that are tagged using 2 tags instead of one. For example I want all photoshop tutorial documents.If I searched with the tag tutorial I would get other software tutorials too and if I use the tag photoshop i get all documents and not just the tutorials. I should be able to provide 2 tags and get documents which are tagged with both these tags.
现在这就是我所做的,
#set ($list = $wiki.tag.getDocuments($tag))
#set ($list2 = $list.getDocuments($tag2))
不用说它不起作用.我的下一次尝试是
Needless to say it does not work. My next attempt was
#set($list = $wiki.tag.getDocuments($tag $tag2))
我想如果我可以修改 getDocuments()
方法,我将能够实现这一点,但我似乎无法找到它.
I guess if I could modify the getDocuments()
method I would be able to achieve this but I can't seem to locate it.
推荐答案
注意:这个答案是由 Vincent Massol 给我的(XWiki 项目的提交者),但他无法用他的 StackOverflow 帐户回答.
NOTE: This answer is given to me by Vincent Massol (a committer on the XWiki project), but he's unable to answer with his StackOverflow account.
您可以使用以下 XWQL 查询来列出所有具有标签tag1"和tag2"的文档:
You can use the following XWQL query which will list all documents having tags "tag1" and "tag2":
{{velocity}}
$services.query.xwql("from doc.object(XWiki.TagClass) as tag where 'tag1' member of tag.tags and 'tag2' member of tag.tags").execute()
{{/velocity}}
有关如何使用 XWQL 的更多信息,请参阅 上的参考文档http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
For more information on how to use XWQL see the reference documentation at http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
这篇关于如何在 xwiki 中检查包含 1 个以上标签的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!