Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Urn on solr doc #26

Merged
merged 5 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/models/spotlight/oaipmh_harvester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def harvest_item(record, job_tracker, job_progress)
resource.attach_image if Spotlight::Oaipmh::Resources.download_full_image
resource.save_and_index

if Spotlight::Oaipmh::Resources.use_solr_document_urns && sidecar = resource.solr_document_sidecars.last.presence
sidecar.urn = resource.data['urn_ssi']
sidecar.save!
end

job_progress&.increment
rescue Exception => e
error_msg = parsed_oai_item.id + ' did not index successfully'
Expand Down
8 changes: 4 additions & 4 deletions app/models/spotlight/resources/oaipmh_mods_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def search_id(exhibit_id)
id_arr << "#{exhibit_id}-#{solr_hash['unique-id_tesim'].gsub('.', '')}" # stripped_decimals w/ exhibit id
id_arr << solr_hash['unique-id_tesim'].gsub('.', '').gsub(':', '') # all_punc_stripped
id_arr << "#{exhibit_id}-#{solr_hash['unique-id_tesim'].gsub('.', '').gsub(':', '')}" # all_punc_stripped w/ exhibit id
if @item_solr['thumbnail_url_ssm'].present?
id_arr << urn = fetch_ids_uri(@item_solr['thumbnail_url_ssm']).split('/').last.split('?').first # urn
id_arr << urn.gsub('.', '').gsub(':', '') # urn with punc stripped
if full_url = @item_solr['full_image_url_ssm'].presence
id_arr << urn = full_url&.split('/')&.last&.split('?')&.first&.gsub(':VIEW', '') # urn
id_arr << urn = urn&.upcase # .gsub('.', '').gsub(':', '') # urn with punc stripped
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the gsubs in this line supposed to be commented out?

parsed_urn_id(urn)
end

Expand Down Expand Up @@ -165,7 +165,7 @@ def uniquify_dates()
end

def parsed_urn_id(urn)
@item_solr['object_id_ssi'] = @item_sidecar['object_id_ssi'] = urn
@item_solr['urn_ssi'] = @item_sidecar['urn_ssi'] = urn
end

# Resolves urn-3 uris
Expand Down
3 changes: 2 additions & 1 deletion lib/spotlight/oaipmh/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
module Spotlight
module Oaipmh
module Resources
mattr_accessor :standard_spotlight_fields, :use_iiif_images, :download_full_image
mattr_accessor :standard_spotlight_fields, :use_iiif_images, :download_full_image, :use_solr_document_urns

self.download_full_image = false
self.standard_spotlight_fields = ['unique-id_tesim', 'full_title_tesim', 'spotlight_upload_description_tesim', 'thumbnail_url_ssm', 'full_image_url_ssm', 'spotlight_upload_date_tesim"', 'spotlight_upload_attribution_tesim']
self.use_iiif_images = true
self.use_solr_document_urns = true # for harvard FTS

# this function maps the vars from your app into your engine
def self.setup
Expand Down