From 82d189a7567bfa027876ea057d2ee2b79aec4a86 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 9 Jun 2026 22:14:11 +0000 Subject: [PATCH] Bug 42795: Do not try to update ES mappings if not using ES patch for main Signed-off-by: Pedro Amorim --- installer/data/mysql/db_revs/251200059.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/db_revs/251200059.pl b/installer/data/mysql/db_revs/251200059.pl index 753481805d..5a2a58b757 100755 --- a/installer/data/mysql/db_revs/251200059.pl +++ b/installer/data/mysql/db_revs/251200059.pl @@ -28,9 +28,17 @@ return { }, undef, $local_number_map_id ); - my $index_name = $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX; - my $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new( { index => $index_name } ); - $indexer->update_mappings(); + # We do want to update the mappings in the DB in case ES gets switched on + # but just skip the ES engine update if ES not enabled + my $searchengine = + $dbh->selectrow_array(q|SELECT value FROM systempreferences WHERE variable = 'SearchEngine'|); + if ( $searchengine eq 'Elasticsearch' ) { + my $index_name = $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX; + my $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new( { index => $index_name } ); + $indexer->update_mappings(); + } else { + say $out "ES disabled, mappings not updated"; + } say $out "Updated ES mappings to make local-number sortable"; } elsif ( !defined $local_number_map_id ) { say_warning( $out, "No mapping defined for local-number" );