small refactoring to patched search#index