Support stubbing the metasearch index

Also, memoize the index stubs so that repeated calls to them within a
test return the same stub.
Functional test for sector expansion