ualbertalib / avalon

University of Alberta's Media Repository based on Avalon
Apache License 2.0
2 stars 2 forks source link

Avalon v6.5: Solr query listing items without waveform #661

Closed jefferya closed 3 years ago

jefferya commented 4 years ago

As per 2020-07-20 ERA A+V meeting:

Todo: [Jeff] Solr query to test waveform property on an object -- test if interrupted e.g., server reboot in the middle

Base on the query portion of: https://github.com/ualbertalib/avalon/blob/v6.5.0.20200707.uofa/script/waveform_backfill.rb#L15

The combine with the following Ruby that doesn't need rails access:

ENV['SOLR_URL']+"select?q=has_model_ssim:MasterFile&fl=id,has_waveform?_bs&rows=1000000&wt=json&sort=file_location_ssi%20asc,id%20asc"
require 'json'
require 'net/http'
require 'uri'

uri_str=ENV['SOLR_URL']+"select?q=has_model_ssim:MasterFile&fl=id,file_location_ssi&rows=1000000&wt=json&sort=file_location_ssi%20asc,id%20asc"

uri = URI.parse(uri_str)
response = Net::HTTP.get_response(uri)

master_file_paths = response.body
result = JSON.parse(master_file_paths)
result["response"]["docs"].each do |doc|
  id = (doc['id']).to_s
  path = (doc['file_location_ssi']).to_s
  puts "#{id}, #{path}" unless File.exist?(path)
end