Adds Group query for complex boolean operations.