Fix advanced search boolean query, fixes #6268