(WIP) Search hooks

Starting work on refactoring the search.

TODO:
* [ ] Write tests
* [ ] Update and extend documentation
* [ ] Add group profile fields to advanced search