Fix search index building

The documents weren't being correctly created due to misuse of $.map().
Implement searching (no results shown yet)