logic to save the search results query