use common function for printing search response.