fixed bug in api/search causing it to crash if term is not passed in via ajaxify, see #1195