Refactor the codesearch::match API a bit.