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

Deleting Works not removing list_source and indirect_containers from Solr #274

Open
roryegerton opened this issue Feb 25, 2016 · 5 comments
Labels

Comments

@roryegerton
Copy link

We currently have the below situation where file_sets are members of works

bw = BibliographicWork.new
bw.save

fs = BibliographicFileSet.new
fs.save

bw.ordered_members << fs
bw.save

This creates the following objects/documents in Fedora and Solr:
1 - ActiveFedora::Aggregation::ListSource
1 - ActiveFedora::Aggregation::Proxy
1 - ActiveFedora::IndirectContainer
1 - BibliographicWork
1 - BibliographicFileSet

When I destroy the FileSet, it deletes itself and its proxy from Fedora and Solr

fs.destroy

This leaves the following objects/documents in Fedora and Solr:

1 - ActiveFedora::Aggregation::ListSource
1 - ActiveFedora::IndirectContainer
1 - BibliographicWork

So far so good, this is all as expected.

However when I destroy the the Work, I am still left with the IndirectContainer and the ListSource in Solr

bw.destroy

Leaves solr documents for:
1 - ActiveFedora::Aggregation::ListSource
1 - ActiveFedora::IndirectContainer

In fedora these aren't accessible as the parent for both these objects is a tombstone

As a work around for now, to ensure that everything is deleted I can carry out the following commands to delete the indirect_container and list_source before deletion:

bw.list_source.destroy
indirect_container = ActiveFedora::IndirectContainer.where(id: "#{bw.id}/members").first #we know there is only one, otherwise we'd loop through each
indirect_container.destroy
bw.destroy

I wonder should this be done in the PCDM models instead?

@tpendragon
Copy link
Contributor

So the problem is that the solr document is left behind, yes? Because that indirect container should be very deleted from Fedora.

@roryegerton
Copy link
Author

Yes when I delete the Work. There is an IndirectContainer and a Aggregation::ListSource document still in solr

@tpendragon
Copy link
Contributor

This is a much more generic problem than Hydra:PCDM. Effectively this is a failure in the sync of Fedora -> Solr. When I delete a root node in Fedora, it deletes all its contained resources as well. However, we don't do anything in that regard in ActiveFedora (with good reason - that'd be slooooww), so the solr document stays in place. So how do we deal with it? DO we deal with it?

Is this something we should be eating up the event stream from Fedora to do?

@jcoyne
Copy link
Member

jcoyne commented Feb 25, 2016

Is there any use in them going into Solr in the first place? Do these have to be AF::Base objects?

@tpendragon
Copy link
Contributor

The list source being in solr is used for a query, I think, but maybe it doesn't have to be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

4 participants