Moves some of the search parts into directives so we can start re-using them.