manage search function