Simplifying things to search.js

As I said on the commit, the purpose of this PR is to get things simpler on search.js.

If you think that the first commit is unnecessary and it's not fair to merge with its existance, just let me know that I make a third PR, with a clean/new fork.
I don't think it was repeating itself. It was checking 3 possible values of the key, which is very readable about what it does.

On a sidenote, for micro-optimization fans, the array lookup is much slower: http://jsperf.com/array-lookup-vs-boolean-and (there is not a lot of data yet, as I just created it)