updated search string URL building, depending on whether a string or an...

... object is passed as search argument

Effective changes are from line 52 to line 66 (the remaining changes are only formating/indenting changes, sorry about that)