Add callback to search function

It was hard to use that function due to lack of callback.