Optimize/refactor frontend for search (refs #834)