[WIP] First round at refactoring Search.controller.php

Sending to get travis and scrutinizer (and your :stuck_out_tongue: ) feedback.
Missing docs.