diff --git a/Gemfile.lock b/Gemfile.lock index 567423566..e22721467 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,7 +109,7 @@ GEM latex-decode (~> 0.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bolognese (1.5) + bolognese (1.5.1) activesupport (>= 4.2.5) benchmark_methods (~> 0.7) bibtex-ruby (>= 5.1.0) diff --git a/app/models/doi.rb b/app/models/doi.rb index c1812b13a..7b3a19859 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -901,12 +901,17 @@ def self.import_by_id(options={}) type: Doi.document_type, body: dois.map { |doi| { index: { _id: doi.id, data: doi.as_indexed_json } } } - # log errors - errors += response['items'].map { |k, v| k.values.first['error'] }.compact.length - response['items'].select { |k, v| k.values.first['error'].present? }.each do |err| - Rails.logger.error "[Elasticsearch] " + err.inspect + # try to handle errors + response['items'].select { |k, v| k.values.first['error'].present? }.each do |item| + import_one(doi_id: item.dig("index", "_id").to_i) end + # log errors + # errors += response['items'].map { |k, v| k.values.first['error'] }.compact.length + # response['items'].select { |k, v| k.values.first['error'].present? }.each do |err| + # Rails.logger.error "[Elasticsearch] " + err.inspect + # end + count += dois.length end