Breaking out getting th formatted search query from the search function