Encodes search query before sending to a backend.