From b63e7be8d0d504ccb908b95feec6177e3abf6dde Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 24 Oct 2020 12:01:18 +0200 Subject: [PATCH] format rake message. datacite/datacite#1134 --- app/models/concerns/indexable.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index 78216b3a5..a841cd4ed 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -856,7 +856,13 @@ def delete_by_query(options={}) return "ENV['QUERY'] is required" if options[:query].blank? client = Elasticsearch::Model.client - client.delete_by_query(index: options[:index], q: options[:query]) + response = client.delete_by_query(index: options[:index], q: options[:query]) + + if response.to_h["deleted"] + "Deleted #{response.to_h["deleted"].to_i} DOIs." + else + "An error occured deleting DOIs for query #{options[:query]}." + end end def doi_from_url(url)