added error checking in searchv2 and searchcontroller