I imagine that might have been a follow-up. Given that he was specifically asked to write a "search" method (and not something more open-ended), the more direct search through the docs might have been what the interviewer intended (though it might have been a plus if the author had said something about some sort of indexing off the bat).