search: keeps the current state of a tab

* used local storage to save the tab state
* cleaned up the code

Signed-off-by: Georgios Kokosioulis <georgios.kokosioulis@cern.ch>