finish serch function