Delete files when a document is deleted, fix search by date