Revert "search: clean up / refactor search result merging code (#3022)"
Created by: ijt
This reverts commit a08c7063fe8afd87b1581754d07b6b4b86e96d74.
This is an attempt to fix #3242 (closed). A previous attempt to revert (56fa240410cbe4390a89820dd55dd6e0bd2748fe) failed because I got confused by how git revert
deals with conflicts.