-
Notifications
You must be signed in to change notification settings - Fork 64
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
fix for import using :label instead of 'label' for some custom fields #3197
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use a test to show how we're handling either symbols or strings for addressing the label
.
@dnoneill I think this partially addresses #2983. It definitely fixes the indexing/import error "undefined method 'downcase' for nil:NilClass"
. I'm still seeing a problem where the imported SolrDocumentSidecar isn't getting attached to the right resources. In the imported exhibit I end up with two sidecars and one isn't associated with the right resource for this exhibit:
[#<Spotlight::Resources::IiifHarvester:0x000000010d2c8d38
id: 19,
exhibit_id: 15,
type: "Spotlight::Resources::IiifHarvester",
url: "https://purl.stanford.edu/bb112zx3193/iiif/manifes...",
data: {},
indexed_at: nil,
created_at: "2024-10-22 11:20:04.366000000 -0700",
updated_at: "2024-10-22 11:20:04.366000000 -0700",
metadata: nil,
index_status: nil,
upload_id: nil>]
exhibits(dev)> Spotlight::SolrDocumentSidecar.where(exhibit_id: '15')
Spotlight::SolrDocumentSidecar Load (0.6ms) SELECT "spotlight_solr_document_sidecars".* FROM "spotlight_solr_document_sidecars" WHERE "spotlight_solr_document_sidecars"."exhibit_id" = ? /* loading for pp */ LIMIT ? [["exhibit_id", 15], ["LIMIT", 11]]
=>
[#<Spotlight::SolrDocumentSidecar:0x000000011d4420a0
id: 32,
exhibit_id: 15,
public: true,
data: {:"iiif-test"=>"iiif test value"},
created_at: "2024-10-22 11:20:04.909000000 -0700",
updated_at: "2024-10-22 11:21:20.403000000 -0700",
document_id: "e452aca00faef95351dbf0e5e37b0241",
document_type: "SolrDocument",
resource_id: 16,
resource_type: nil,
index_status: {},
tag_list: nil>,
#<Spotlight::SolrDocumentSidecar:0x000000011d441f60
id: 33,
exhibit_id: 15,
public: true,
data:
{"readonly_available-online_tesim"=>["https://purl.stanford.edu/bb112zx3193"], "readonly_title_tesim"=>["Bugatti Type 51A. Road & Track Salon January 1957"], "readonly_contributor_tesim"=>["Hearst Magazines, Inc. (former ownerfmo)", "Chesebrough, Jerry (photographerpht)"], "readonly_type_tesim"=>["Photographic prints", "StillImage"], "readonly_format_tesim"=>["1 folder", "image/tiff"], "readonly_language_tesim"=>["Englisheng"], "readonly_description_tesim"=>["Black and white photographic prints of the Bugatti Type 51A, used in issues of Road and Track magazine between 1957 and 1961."], "readonly_subject_tesim"=>["Bugatti", "Bugatti T51A", "Bugatti automobile"], "readonly_date_tesim"=>["1957-1961"], "readonly_identifier_tesim"=>["M1919_b129_f02", "https://purl.stanford.edu/bb112zx3193"], "readonly_relation_tesim"=>["Stanford University. Libraries. Department of Special Collections and University Archives", "Road & Track magazine records, circa 1947-2012"], "readonly_publishdate_tesim"=>["2024-05-08T06:40:12Z"], "readonly_attribution_tesim"=>["Provided by the Stanford University Libraries"]},
created_at: "2024-10-22 12:37:44.833952000 -0700",
updated_at: "2024-10-22 12:37:44.842736000 -0700",
document_id: "caf2778df19f8b7f05411227b7b0504a",
document_type: "SolrDocument",
resource_id: 19,
resource_type: nil,
index_status: {},
tag_list: nil>]
Whereas in the original exhibit I exported the data looked like:
exhibits(dev)> Spotlight::Resource.where(exhibit_id: '12')
Spotlight::Resource Load (0.5ms) SELECT "spotlight_resources".* FROM "spotlight_resources" WHERE "spotlight_resources"."exhibit_id" = ? /* loading for pp */ LIMIT ? [["exhibit_id", 12], ["LIMIT", 11]]
=>
[#<Spotlight::Resources::IiifHarvester:0x000000011d4461a0
id: 16,
exhibit_id: 12,
type: "Spotlight::Resources::IiifHarvester",
url: "https://purl.stanford.edu/bb112zx3193/iiif/manifes...",
data: {},
indexed_at: nil,
created_at: "2024-10-22 11:20:04.366690000 -0700",
updated_at: "2024-10-22 11:20:04.366690000 -0700",
metadata: nil,
index_status: nil,
upload_id: nil>]
exhibits(dev)> Spotlight::SolrDocumentSidecar.where(exhibit_id: '12')
Spotlight::SolrDocumentSidecar Load (0.3ms) SELECT "spotlight_solr_document_sidecars".* FROM "spotlight_solr_document_sidecars" WHERE "spotlight_solr_document_sidecars"."exhibit_id" = ? /* loading for pp */ LIMIT ? [["exhibit_id", 12], ["LIMIT", 11]]
=>
[#<Spotlight::SolrDocumentSidecar:0x000000010c97eb10
id: 27,
exhibit_id: 12,
public: true,
data: {"iiif-test"=>"iiif test value"},
created_at: "2024-10-22 11:20:04.909936000 -0700",
updated_at: "2024-10-22 11:21:20.403167000 -0700",
document_id: "e452aca00faef95351dbf0e5e37b0241",
document_type: "SolrDocument",
resource_id: 16,
resource_type: nil,
index_status: {},
tag_list: nil>]
It seems fine to me to deal with this separately, but this PR does not fully close #2983
closes #2983
What I found with this is when update runs for the license field, it makes the config :label => 'License' not 'label' => 'License'. I checked the data. It looks exactly the same as all the other fields.