Getting documents that do not have a specific tag?
i'm trying to construct a query that would get me all documents that have not been tagged with a particular tag. I started out with a query that would give me the documents that had been tagged, somehting like:
SELECT * FROM Document WHERE ecm:currentLifeCycleState <> "deleted" AND ecm:tag = "mytag"
This worked fine, so I tried the (probably naive) approach of simply inverting the equality operator
SELECT * FROM Document WHERE ecm:currentLifeCycleState <> "deleted" AND ecm:tag <> "mytag"
However, this returned me a different set than what I was looking for. It did not return documents that had no tag at all, and it returned a document that was tagged “mytag” but was also tagged with something else.
Does anyone have a suggestion for me how to get all files that have no tag matching “mytag”? Thanks in advance!
Please read NXQL and search for
ecm:tag, and note that the syntax is similar to that of complex properties.
But to be honest we've never considered negative matches for tags. You may want to play with things like
ecm:tag/* and also note that checking for
IS NULL is useful in negative queries for complex properties.