search: try to make the better matches come on top.

This appends a new (lest-priority) criterion on the search ordering: if a
shorter string matches the needle, it should come first (for it's a better
match).