[bugfix] Fix crash when blank string passed to Search#

This is a port of PR #371 on the master branch.