Add search unit test and debug