I’m trying to run a query to find pages that have NOT been tagged with a specific tag in a space. I know that to find pages WITH a tag, I can use the query string:
"select doc.title, doc.fullName from Document doc,
doc.object(XWiki.TagClass) tag
where ('someTag' member of tag.tags) and
(doc.space like :space or doc.space like ':space.%')
order by doc.fullName asc"
However, the inverse doesn’t work:
"select doc.title, doc.fullName from Document doc,
doc.object(XWiki.TagClass) tag
where ('someTag' not member of tag.tags) and
(doc.space like :space or doc.space like ':space.%')
order by doc.fullName asc"
When I run this query, it will return the following:
- Pages that have tags that are not someTag.
- Pages that have been tagged previously, but no longer have any tags.
The query misses:
- Pages that have never been tagged.
So the query seems to only find pages that have had a TagClass object initialized at some point in the page’s existence.
What is the proper way to query for pages WITHOUT a specific tag?