If the query list contains an operator, put quotes around the term.
Fix crash when there are no pairs.
Merge commit '325219c9903a4e63a96c55773e3548967acce81b'
cherry picked clustering fix