Merge search function