Properly replace search results