escape query term. improved whitespace handling and wildcard building