updated db query for search controller and unittest