Bugzilla – Attachment 148592 Details for
Bug 33019
Records not indexed in Elasticsearch ES when first catalogued
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33019: Make sure ES records are indexed the first time
Bug-33019-Make-sure-ES-records-are-indexed-the-fir.patch (text/plain), 2.60 KB, created by
Jonathan Druart
on 2023-03-23 09:03:17 UTC
(
hide
)
Description:
Bug 33019: Make sure ES records are indexed the first time
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-03-23 09:03:17 UTC
Size:
2.60 KB
patch
obsolete
>From 78e57cd7abe84e88dc91a56ab44ccb1d0c33909b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 15 Feb 2023 23:50:33 +1300 >Subject: [PATCH] Bug 33019: Make sure ES records are indexed the first time > >This patch ensures records are indexed when they are created. >Previously, we were launching the indexer inside of of a transaction. >This meant that the job was being enqueued, but not being found by the >worker, becaue it was not yet in the DB > >This patch skips record indexing in the transaction, and moves the indexing >command after > >To test: >1 - Make sure you are using ES, and the es indexer is running >2 - tail -f /var/log/koha/kohadev/*.log >3 - Create a new record >4 - Note error in es-indexer-output.log like: > [2023/03/21 12:22:36] [WARN] No job found for id=157 main:: /kohadevbox/koha/misc/workers/es_indexer_daemon.pl (129) >5 - Apply patch >6 - Create another record >7 There should be no error >8 - Search for the record and confirm it can be found >9 - View the background jobs in admin, confirm the most recent job has completed > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Biblio.pm | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 1af5e126969..7a49f47df7c 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -287,8 +287,8 @@ sub AddBiblio { > BiblioAutoLink( $record, $frameworkcode ); > } > >- # now add the record >- ModBiblioMarc( $record, $biblionumber, { skip_record_index => $skip_record_index } ) unless $defer_marc_save; >+ # now add the record, don't index while we are in the transaction though >+ ModBiblioMarc( $record, $biblionumber, { skip_record_index => 1 } ) unless $defer_marc_save; > > # update OAI-PMH sets > if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { >@@ -298,7 +298,13 @@ sub AddBiblio { > _after_biblio_action_hooks({ action => 'create', biblio_id => $biblionumber }); > > logaction( "CATALOGUING", "ADD", $biblionumber, "biblio" ) if C4::Context->preference("CataloguingLog"); >+ > }); >+ # We index now, after the transaction is committed >+ unless ( $skip_record_index ) { >+ my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); >+ $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" ); >+ } > } catch { > warn $_; > ( $biblionumber, $biblioitemnumber ) = ( undef, undef ); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33019
:
146999
|
148444
|
148447
|
148572
|
148591
| 148592