They were probably trying to post spam and thought your search bar was a comment input field.
There also seems to be a few distinct bots doing this, with distinct user agents (but bots with the same UA spam-search on the same topic out of epharma, casino, warez).
I also have another, identical search box in another part of the site and it has never seen any sort of spam bots.
Nobody seems to write much about it, maybe because they don't want to give people ideas, but it's an endlessly fascinating subject.