0005995: search with spaces only causes MySQL exception (cherry picked from commit c551f5f)