DRYing up the two kinds of search