This code has been shuffled around and adjusted, but structurally isn't much different than it was in 2004 when search rendering was pulled out of the SearchEngine class and moved into the SpecialSearch class. Since then various things have changed, but the class itself has never been refactored to make sense of what it actually does today. As such it is, quite frankly, a complete mess of things bolted ontop of each other.
Someone needs to go through this and try and figure out what the main ideas are, and refactor into something that has a clear and defined execution flow. Bonus points if somehow most of the logic can be separated from the rendering.