Trim search string input

Trim search string input fixes #4945