Deals with trailing whitespace in search queries.