merged the search logic from the contact table.