Fix history search to remove only past deleted records

review1481002