The AP Style Manual, a/the leading source for US journalism at least, says
<word> <space> <dash> <space> <word>
Outside of journalism, usually there is no padding, only, <word> <dash> <word>
I'm with you: For searches, the spaces make the words easier to parse. Those rules predate computers, I would guess.