put the search function into frontend