Moving search out into a shareable module

Signed-off-by: Alan Gardner <alan@armoin.com>