sul-dlss-deprecated / portfolios

https://eportfolio.stanford.edu/
Other
0 stars 1 forks source link

Update to spotlight 2.0 #26

Closed jkeck closed 6 years ago

jkeck commented 6 years ago

includes commits from #23, #24, and #25 so those should be merged first

This will require updates to ePortfolio's sul-solr configs to match the change here.

NOTE: We will need to run the spotlight:migrate_pages_language when deploying this.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 96.473% when pulling a66f6a8530b65fe95a766f98a8d28105e25c9473 on update-spotlight2 into a939173fcba3d90ef979a3055b06069292bc4f27 on master.

jkeck commented 6 years ago

Something else to keep in mind with this is we update the configuration in a way that will require a bit of a solr data migration to make things work exactly right. There are 5 records in ePortfolios that will need to have their title and date field migrated to their new spotlight_upload_* equivalents. Otherwise, when rending the edit form for these records, the title and date field will be blank even if data was filled out (since it is now referencing a field that has no data populated). We are going this way now to allow us to use solr copyFields instead of configuring them in the application layer.

https://solr-host/solr/eportfolio_prod/select?fq=spotlight_resource_type_ssim:spotlight/resources/uploads&fl=id,title*,date*&wt=json

Something along the lines of might work as a data migration

Spotlight::Resources::Upload.find_each do |upload|
  data = upload.data
  upload.data = data.merge(
    'spotlight_upload_title_tesim': data['title']
    'spotlight_upload_date_tesim': data['date']    
  ).delete_if{ |_, v| v.nil? }

  upload.save_and_index
end
jkeck commented 6 years ago

Attempted to add the data migration in my comment above into a reversible migration in 18603e6ec29adb28c181dc14397da288bc791ee3

Not sure if this is even a good idea. Keeping it in a separate commit so feel free to remove it (or I'm happy to if I'm sill available).