scientist-softserv / adventist_knapsack

Apache License 2.0
1 stars 0 forks source link

🐛 Fix slug based deletion via Hyrax::Transactions #61

Closed jeremyf closed 9 months ago

jeremyf commented 9 months ago

The following code in Hyrax v3.5.0 is managing the delete via the Hyrax::Transactions functionality. The code is as follows:

def delete(resource:)
  af_object = ActiveFedora::Base.new
  af_object.id = resource.id
  af_object.delete
  resource
end

The primary problem we're encountering is that this instantiates a bare bones ActiveFedora::Base object that has an ID, but no other properties (in particular the slug, which is the SolrDocument's ID).

This commit repurposes the logic of reindexing when we add/remove an AARK_ID. Important is that we attempt deletes both the id in SOLR (which is the Fedora slug value) and delete on the fedora_id_ssi (which is the resource.id from above).

Related to: