Escaping of special characters in query terms belongs to median