search and merge