Trim strings that are formatted to go into solr queries

Before this patch, if you searched for a string (say hostname) with leading whitespace, the result would be all assets, whereas if you had trailing whitespace, you would always get the empty set.