enable back/forward between search terms

The search pattern is both appended to the url as query parameter to
support e.g. bookmarking, and to state object, which is used to enable
back/forward between search terms when there are no page loads.