Bug 40577

Summary: Bulk biblio ES index update after auth change
Product: Koha Reporter: Thomas Klausner <domm>
Component: Searching - ElasticsearchAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

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...