Small refactoring of indexed search