updates search function to generic function