search: move internal httpapi code into own file
Created by: keegancsmith
It feels like most of this shouldn't be living in this layer, since it is business logic. A good first step is moving it into its own file.
This is a pure refactor, only cut, paste and goimports.