Refactor search js: using template instead of string

* all specs pass
* manual tests look ok
* please delete branch after merge