Apply search function