Search guards

Primarilly try/catch to guard against the search server disappearing.
Also one for an empty search string - this wasn't being trimmed before.