diff --git a/lib/tasks/doi.rake b/lib/tasks/doi.rake index f79cefc34..cb7122359 100644 --- a/lib/tasks/doi.rake +++ b/lib/tasks/doi.rake @@ -154,6 +154,24 @@ namespace :doi do Doi.loop_through_dois(options) end + desc "Trigger DOI Update based on query" + task update_dois_by_query: :environment do + # Ensure we have to specify a query of some kind. + if ENV['QUERY'].nil? + puts "ENV['QUERY'] is required" + exit + end + + options = { + query: ENV["QUERY"], + label: "[UpdateDoiByQuery]", + job_name: "UpdateDoiJob", + cursor: ENV["CURSOR"].present? ? Base64.urlsafe_decode64(ENV["CURSOR"]).split(",", 2) : [], + } + puts Doi.loop_through_dois(options) + end + + # until all Crossref DOIs are indexed as otherDoi desc "Refresh metadata" task refresh: :environment do