Bug 40577 - Bulk biblio ES index update after auth change
Summary: Bulk biblio ES index update after auth change
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-01 13:35 UTC by Thomas Klausner
Modified: 2025-08-01 13:35 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2025-08-01 13:35:53 UTC
In C4::AuthoritiesMarc->merge, when merging two authorities (which is also called after ModAuthority), we check if there are biblios linked with the auth and if the auth data materialzied into those biblios needs update. If we do have a "trivial" update of the biblio (lines 1787ff), see below, we index each biblio on its own:

 if (  !$update
       && $reindex_if_needed
       && $syspref_include_see_from )
 {
       my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
       $indexer->index_records( $biblio->biblionumber, "specialUpdate", "biblioserver" );
 }

This will create one background job per biblio.

But we could easily just create on background job for all those modifications, which should improve performance.

I'm proposing a very small change, where instead of calling indexer->index_records, we push $biblio->biblionumber on an array. And after looping through all the biblios, we create one index job using that array.

If there is some consensus that that's a good idea, I can implement it and write a test plan...