Issue #2211241 by jhodgdon, ianthomas_uk: Refactor search_reindex() into separate functions