Skip to content

Instantly share code, notes, and snippets.

@awead
Created February 2, 2017 17:03
Show Gist options
  • Save awead/217e7edcf3de2444c2283228878aaee5 to your computer and use it in GitHub Desktop.
Save awead/217e7edcf3de2444c2283228878aaee5 to your computer and use it in GitHub Desktop.
QA reporting
# List of fileset ids in the last 60 days:
fs_ids = ActiveFedora::SolrService.query("has_model_ssim:FileSet", rows: 100000, fq: "date_uploaded_dtsi:[NOW-60DAY/DAY TO NOW]", fl: ["id"]).map(&:id)
# Ids of orphaned file sets from the list created above:
fs_ids.map { |id| id unless ActiveFedora::SolrService.query("member_ids_ssim:#{id}").present? }.compact
=> ["0k643b017c"]
# Check timestamp differences between system create date and date uploaded
# Returns an array of FileSet labels where the set's date differences are 5 seconds or less and the set has no parent
ActiveFedora::SolrService.query("has_model_ssim:FileSet", fq: "{!frange l=0 u=5000}ms(system_create_dtsi,date_uploaded_dtsi)", rows: 10000).map { |fs| fs unless FileSet.find(fs.id).parent.present? }.compact.map { |hit| hit.id }
=> ["0k643b017c"]
# This all points to: https://scholarsphere-qa.dlt.psu.edu/concern/file_sets/0k643b017c
# which is the one problem upload we've had.
# Looking at it the other way... works without members in the last 60 days:
ActiveFedora::SolrService.query('-member_ids_ssim:["" TO *]', fq: ["has_model_ssim:GenericWork","date_uploaded_dtsi:[NOW-60DAY/DAY TO NOW]"] ).map { |hit| hit.id }
=> ["hmg74qm55g"]
# which points to the work page of the problem upload: https://scholarsphere-qa.dlt.psu.edu/concern/generic_works/hmg74qm55g
# ie. the one that doesn't load!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment