When entering the search view, remember the previous query and restore it when leaving the search view.