Bug 26466 - koha-rebuild-zebra should reset index if there are no data to index
Summary: koha-rebuild-zebra should reset index if there are no data to index
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Zebra (show other bugs)
Version: Main
Hardware: All Linux
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-15 15:13 UTC by Anke Bruns
Modified: 2020-10-19 16:52 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anke Bruns 2020-09-15 15:13:29 UTC
Koha still finds results for bib records even though all bib records have been deleted from the instance. Zebra index has been rebuilt with option -f after deleting, so I would expect no search results at all.

The search results lead to empty records anyway, but they shouldn't be there at all.

What else has to be deleted exept items, deleteditems, biblioitems, deletedbiblioitems, biblio, deletedbiblio, biblio_metadata, deletedbibliometadata so that Zebra won't find anything after rebuilding?

Is there another way to empty a Koha instance of its bib records apart from TRUNCATE-ing the tables mentioned above in the database?

Thanks!
Comment 1 David Cook 2020-09-16 04:16:17 UTC
This sounds like a support request rather than a bug.

Questions about Koha should be asked on the Koha mailing list
(http://koha-community.org/support/koha-mailing-lists/) or in the #koha IRC
channel (http://koha-community.org/get-involved/irc/).

Hopefully you've already seen the Koha documentation:
http://koha-community.org/documentation/

You can also find options for paid support here:
https://koha-community.org/support/
Comment 2 Anke Bruns 2020-09-16 07:45:17 UTC
Hi,

well, it's probably a mixture of a bug report and a support request.

And yes, I've searched the documentation for this problem (otherwise I wouldn't have filed the bug in the first place).

Anyway it does seem to me a bug if I delete everything from the tables mentioned* and then rebuild zebra and still find index entries even though there are no records.

*(as found in this documentation:

https://kohageek.blogspot.com/2017/12/delete-records-in-koha.html

which refers to

http://koha.1045719.n5.nabble.com/Step-by-Step-process-to-delete-records-td5761474.html,

adding 

TRUNCATE biblio_metadata;
TRUNCATE deletedbiblio_metadata;

because I thought they might have to be deleted, too.)

Anyway, thanks for the advice, I'll see if I can solve the problem somewhere else.
Comment 3 Katrin Fischer 2020-09-16 07:54:53 UTC
Hi Anke,

David's comment might have sounded a little harsh - it's a template we use when we think people will get better help on the English mailing list. The main reason is that only a few people read all the bug changes (as QAM I feel like i have to :) )

What I think the issue is, is that when you delete everything, the Zebra index doesn't reset when you do a full reindex. We could make make this into a bug saying that -f should be doing that.

What you can probably do: Catalog a record manually. I tmight have the intended effect.

And I found this:

https://koha-community.org/manual/20.05/en/html/faq.html#reset-the-zebra-index

You should definitely also truncate biblio_metadata. I believe there shoud be some cascading (automatic deletion of data in related tables) going on between tables, but not completely sure (bilbio - biblioitems - biblio_metadata - items).
Comment 4 Anke Bruns 2020-09-16 08:07:17 UTC
Dear Katrin, thanks for clarifying!

Yes, meanwhile I found this, too:

http://manual.koha-community.org/3.12/en/resetzebra.html (linked from 
http://manual.koha-community.org/3.12/en/resetkohadb.html, linked from
http://koha.1045719.n5.nabble.com/Step-by-Step-process-to-delete-records-td5761474.html linked from https://kohageek.blogspot.com/2017/12/delete-records-in-koha.html mentioned in my initial post). I was wrong by rebuilding zebra with the koha-rebuild-zebra command instead of zebraidx. With the latter, it worked fine, and correctly, no more results are found.

So, actually it was in the docu, not all that easy to find, but there anyway. I do apologize.

I wrote a wiki article for our own wiki to document the process of deleting data from a Koha instance without losing the config settings, and if anyone cares, I could translate it into English for the community wiki. The advantage is that the information from different sites out there would be in one place and more straightforward to find. Please just tell me.

Thanks again,
Anke
Comment 5 David Cook 2020-09-16 23:19:08 UTC
(In reply to Anke from comment #4)
> I wrote a wiki article for our own wiki to document the process of deleting
> data from a Koha instance without losing the config settings, and if anyone
> cares, I could translate it into English for the community wiki. The
> advantage is that the information from different sites out there would be in
> one place and more straightforward to find. Please just tell me.

That sounds like a great idea. Personally, I almost never delete all bib data from Koha, so this is rarely an issue that I encounter. However, if you've encountered it, it is likely that someone else has too. Contributions to the wiki, especially in regards to Zebra, are always welcome.

If you don't already have an account, I'd suggest requesting one here: https://wiki.koha-community.org/wiki/Special:RequestAccount

And you do make a good point. It is arguably an issue in the Zebra re-indexing, so I apologize for being hasty in thinking this was just a support request. This could be explored as a bug or an enhancement.
Comment 6 Anke Bruns 2020-09-17 12:23:03 UTC
https://wiki.koha-community.org/wiki/How_to_delete_all_records_and_keep_settings

This is what I wrote, actually I mostly collected and edited text from other sources mentioned in "References", adding some extra information.

The Zebra issue has been solved by using zebraidx instead of koha-rebuild-zebra after truncating the tables.
Comment 7 Anke Bruns 2020-09-21 09:10:08 UTC
I think this can be closed as resolved now. The problem I encountered was in using koha_rebuild_zebra instead of zebraidx for resetting the Zebra index after deleting the data.
Comment 8 Katrin Fischer 2020-10-19 16:52:03 UTC
I believe you are not the first to have run into this issue and having the koha-rebuild-zebra issuing a warning or similar when nothing was found to index could still be helpful. Reclassifying as an enh now.