How can a document only be located under a tag?

And you can use this script to make sure that all records are at least in one normal group.