Bug 26750 - Deleted items are not removed from index
Summary: Deleted items are not removed from index
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Björn Nylén
QA Contact: Nick Clemens
URL:
Keywords:
Depends on: 23463
Blocks:
  Show dependency treegraph
 
Reported: 2020-10-20 12:12 UTC by Björn Nylén
Modified: 2020-11-23 19:59 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.06


Attachments
Index after item deletion (1.40 KB, patch)
2020-10-20 12:34 UTC, Björn Nylén
Details | Diff | Splinter Review
Bug 26750: Deleted items not indexed (1.61 KB, patch)
2020-10-24 21:17 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 26750: Deleted items not indexed (1.67 KB, patch)
2020-10-25 00:29 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Nylén 2020-10-20 12:12:34 UTC
When deleteing an item, the iten can still be found in the index.

it's similar to bug 26507 that reindexing occurs before the item is actually deleted from the db.  

Working on sumitting a patch.
Comment 1 Björn Nylén 2020-10-20 12:34:50 UTC
Created attachment 112030 [details] [review]
Index after item deletion
Comment 2 Björn Nylén 2020-10-20 12:35:45 UTC
After deleting an item it is still searchable in the index. Similar to bug 26507 where record is reindexed before the database is changed.

To test:
1. Delete an item
2. Search the barcode in the main search box. You'll find the original record but wiht hte deleted item missing.
3. Apply patch.
4. Repeat steps 1-2 (with another item). No record should be found.
Comment 3 Séverine Queune 2020-10-20 13:55:52 UTC
Can't reproduce using ElasticSearch, is that a specific Zebra problem ?
Comment 4 Björn Nylén 2020-10-20 14:09:53 UTC
No we're using ES as well. The issue is in the  Koha::Itemm->delete call where indexing takes place before deletion. We're on 20.05.03 and the problem is there. The indexing call is changed in master but the order of events is the same.
Comment 5 Chris Cormack 2020-10-24 21:17:51 UTC
Created attachment 112401 [details] [review]
Bug 26750: Deleted items not indexed

After deleting an item it is still searchable in the index. Similar to bug 26507 where record is reindexed before the database is changed.

To test:
1. Delete an item
2. Search the barcode in the main search box. You'll find the original record but wiht hte deleted item missing.
3. Apply patch.
4. Repeat steps 1-2 (with another item). No record should be found.

Note to test you have to have the indexer running, not the cron job, and it
needs to be running fast so that the index is updated before the delete
takes place

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 6 Nick Clemens 2020-10-25 00:29:46 UTC
Created attachment 112435 [details] [review]
Bug 26750: Deleted items not indexed

After deleting an item it is still searchable in the index. Similar to bug 26507 where record is reindexed before the database is changed.

To test:
1. Delete an item
2. Search the barcode in the main search box. You'll find the original record but wiht hte deleted item missing.
3. Apply patch.
4. Repeat steps 1-2 (with another item). No record should be found.

Note to test you have to have the indexer running, not the cron job, and it
needs to be running fast so that the index is updated before the delete
takes place

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens 2020-10-25 00:30:28 UTC
Logging and item hooks still get necessary info after this and indexing works, nice one!
Comment 8 Jonathan Druart 2020-10-25 23:09:18 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 9 Lucas Gass 2020-11-13 18:24:16 UTC
backported to 20.05.x for 20.05.06
Comment 10 Aleisha Amohia 2020-11-17 04:18:17 UTC
doesn't apply cleanly for 19.11.x, please rebase
Comment 11 Björn Nylén 2020-11-23 18:59:25 UTC
(In reply to Aleisha Amohia from comment #10)
> doesn't apply cleanly for 19.11.x, please rebase

This bug was introduced by Bug 23463 so shouldn't exist in 19.11
Comment 12 Aleisha Amohia 2020-11-23 19:59:30 UTC
(In reply to Björn Nylén from comment #11)
> (In reply to Aleisha Amohia from comment #10)
> > doesn't apply cleanly for 19.11.x, please rebase
> 
> This bug was introduced by Bug 23463 so shouldn't exist in 19.11

Thanks, I'll add this to the bug report.