Small search fix

Changed search and index methods to work when comparisons return
numbers other than -1, 1, and 0.