init function of search