Partially refactor paste search.

Summary: Move some search code from the paste application to the search infrastructure.

Test Plan: Check paste searches still work.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan

Maniphest Tasks: T2625

Differential Revision: https://secure.phabricator.com/D5734