add search function

添加搜索功能
better to make if a var xxx = function(), nest is less readable.