s = RSolr.connect url: 'http://solr.repo.vpc.rdc.library.northwestern.edu/solr//avalon'
r = (s.get 'select', params: {q: 'has_model_ssim:MasterFile', rows: 9999999})['response']['docs']
orphans = []
r.each do |mf|
orphans << mf if mf['isPartOf_ssim'].blank?
end
orphans.each do |o|
mf = MasterFile.find(o['id'])
mf.destroy
end
We have master files that don't belong to any MediaObject that are creating issues with #374 in terms of iterating over all the master files, since isPartOff on a master file is never expected to be blank. These master files are not visible to users and probably the legacy of poorly deleted MediaObjects. Removing them.
We have master files that don't belong to any MediaObject that are creating issues with #374 in terms of iterating over all the master files, since
isPartOff
on a master file is never expected to be blank. These master files are not visible to users and probably the legacy of poorly deleted MediaObjects. Removing them.