- Issue created by @danflanagan8
- Status changed to Needs review
almost 2 years ago 1:41pm 27 April 2023 - last update
almost 2 years ago 1 fail - last update
almost 2 years ago 1 pass - πΊπΈUnited States danflanagan8 St. Louis, US
Here's a fail test and a fix.
The approach in the IS didn't quite pan out because `searchIndex` is protected. Instead I followed the code in the Node class very closely. Seems to work!
This would not clear out data for previously deleted nodes though. That could happen in an update hook, but I don't have the energy for that at the moment.
Also note that the new test coverage here conflicts with the new test coverage in another issue I worked on: π Changing exclude criteria and reindexing does not remove newly excluded nodes from search index Needs review
I think that issue is more important so I'd like to see that fixed first. Then this patch could be rerolled.
The last submitted patch, 2: search_exclude-node-delete-3356664-2-FAIL.patch, failed testing. View results β
- Status changed to RTBC
2 months ago 9:48pm 6 February 2025 - πΊπΈUnited States majorrobot
My team also ran into this issue. The patch worked perfectly for us.
We also ran a node_update_N() to clear nodes from the index that we had already deleted (we only had a handful of nodes). This might be helpful for others:
function my_module_update_N(&$sandbox) { $nids = [...]; // Your list of nodes. $search_index = \Drupal::service('search.index'); foreach ($nids as $nid) { $search_index->clear('search_exclude_node_search', $nid); } }
- First commit to issue fork.
- Merge request !15#3356664: Node data stays in index after node is deleted β (Merged) created by baikho
-
baikho β
committed 8bc8f455 on 3.x
#3356664: Node data stays in index after node is deleted
-
baikho β
committed 8bc8f455 on 3.x