correctly encode search query