Fixed inaccurate query when tag is multi-applied

Two users can apply the same tag to an object. It is necessary to adapt
queries to use distinct when using count to determine that all tags are
present on an object