Sha256: 548f35afb0d12b7b013681e5ece10731af2b3bbf996c562c929564decd0ea07f

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

require "csv"

namespace :geoblacklight_admin do
  namespace :images do
    desc "Harvest image for specific document"
    task harvest_doc_id: :environment do
      GeoblacklightAdmin::StoreImageJob.perform_later(ENV["DOC_ID"])
    end

    desc "Harvest all images"
    task harvest_all: :environment do
      query = "*:*"
      index = Geoblacklight::SolrDocument.index
      results = index.send_and_receive(index.blacklight_config.solr_path,
        q: query,
        fl: "*",
        rows: 100_000_000)
      # num_found = results.response[:numFound]
      # doc_counter = 0
      results.docs.each do |document|
        sleep(1)
        begin
          GeoblacklightAdmin::StoreImageJob.perform_later(document["id"])
        rescue Blacklight::Exceptions::RecordNotFound
          next
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geoblacklight_admin-0.4.1 lib/tasks/geoblacklight_admin/images.rake
geoblacklight_admin-0.4.0 lib/tasks/geoblacklight_admin/images.rake