search: template hierarchy

* Changes the template hierarchy so index.html is more specific than collection.html.
* Adds basic documentation about the template hierarchy.
* PEP8/PEP257 loves (with some `TODO` and `FIXME` though).