clean the search query before appending