Category search changes
I swear I didn't just do this so that "Computer Systems" is the first result for "CompSys".
- Resolves ties using length, so that shorter values are preferred
- Improves comments so that cost is used consistently instead of score, which was the previously used term
- applies an optimization where the match isn't computed for results which would've been too bad, this saves a couple of heap allocations
- precompute toLowerCase in hook function so that
a.toLowerCase()
isn't called n times.