Fixes #6544 adds UNION queries
Merge pull request #6740 from dotCMS/issue-6544-slow-query

Fixes #6544 adds UNION queries