Islandora / islandora

Drupal modules for browsing and managing digital repositories.
http://islandora.ca/
GNU General Public License v2.0
152 stars 118 forks source link

Expected behavior when taxonomy fields are deleted #1049

Open DonRichards opened 3 months ago

DonRichards commented 3 months ago

Overview of feature request

This feature request aims to address a bug related to the deletion of taxonomy fields and their impact on the Solr index. When a taxonomy field indexed by Solr is deleted, it can cause white-screen errors due to inconsistencies between the Solr index and the data.

What kind of user is the feature intended for?

Developer

What inspired the request?

The need to prevent white-screen errors and improve the stability of the Islandora system when a taxonomy field that is indexed by Solr is deleted.

What existing behavior do you want changed?

Currently, deleting a taxonomy field that is indexed by Solr leads to an inconsistent Solr index, which can result in white-screen errors and make troubleshooting difficult.

Any brand new behavior do you want to add to Islandora?

Implement a function that removes Solr facets and fields associated with a deleted taxonomy field to maintain index consistency and prevent errors.

Any related open or closed issues to this feature request?

None specified.

rosiel commented 3 months ago

Something that i'm aware of that might be coming into play here, is that when you delete a taxonomy term, it does not delete references to it. All nodes that linked to that term, still have that term stored in their field. It is very hard to see this because whenever a term is rendered, it is loaded, and if it can't be loaded then it just ignores it. But you can see the reference if you go to [site]/node/[nid]?_format=json (note, just json not jsonld). The folks at DGI (sorry, can't recall who) suggested this module https://www.drupal.org/project/entity_reference_integrity which has a submodule that won't let you delete a term if it's referenced by nodes.

My suspicion, knowing this, is that Solr is breaking at least in part because it's trying to index and/or render taxonomy terms that have been deleted.

adam-vessey commented 3 months ago

@rosiel: To deal with some other types of entity references, it might also be necessary to use something like: https://github.com/discoverygarden/entity_reference_integrity_extra/

IIRC, those TypedRelation fields (and any other non-core extended "entity reference" fields) would not get picked up by the core entity_reference_integrity processes.

kayakr commented 3 months ago

@rosiel fyi, we've been using https://www.drupal.org/project/entity_reference_purger on a site to deal with some of these dangling term references.