implement the search API endpoint