Try search repeatedly until success

This PR picks up the investigative work done by @joshmoore in gh-2857 in trying to eliminate some intermittent search test failures that may be due to the time taken to index. The set of tests most frequently failing are the `3164` tests. This PR splits up the helper for those tests and modifies the search phase to run until success or, currently, 10 iterations. The rationale behind splitting the helper is to later formalise this using fixtures/decorators if the solution proves to work.

This PR doesn't need formal review yet but any search test failures in the daily build need flagging up here.