Add improved cache invalidation to searchDocuments