Update search classes

@butonic, here is the pull request for the changes we discussed in #1473. This currently makes no client-side changes so it doesn't fix anything more from issue #4248. I think the sub-classing of results is a step in the right direction, though, which I can use to continue to improve core search.

After this stuff I want to start working on some more client-side fixes like the list you posted in #4248 and the bugs lyallp mentioned.