[bug 897443] Rework badge search to be clearer

This redoes some of the layout and formatting for badge search so it's
clearer what's query text the user typed in and what isn't.

I tried to reduce the number of changes, so the code is a little clunky.

r?