Extract #search_index_for method, it is being used more broadly

Added additional specs