From ee9451389c0b70df6ebf589e21753ba68db3cf29 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Wed, 19 Feb 2025 18:27:17 +0100 Subject: [PATCH] Bug 39171: Rename IS02709 ElasticsearchMARCFormat to base64ISO2709 To test: 1) Apply patch 2) Make sure tests in t/db_dependent/Koha/SearchEngine/Elasticsearch.t pass Signed-off-by: David Cook Signed-off-by: Thomas Klausner --- ...709_ElasticsearchMarcFormat_to_base64ISO2709.pl | 14 ++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/admin.pref | 4 ++-- t/db_dependent/Koha/SearchEngine/Elasticsearch.t | 6 +++--- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_39171-rename_IS02709_ElasticsearchMarcFormat_to_base64ISO2709.pl diff --git a/installer/data/mysql/atomicupdate/bug_39171-rename_IS02709_ElasticsearchMarcFormat_to_base64ISO2709.pl b/installer/data/mysql/atomicupdate/bug_39171-rename_IS02709_ElasticsearchMarcFormat_to_base64ISO2709.pl new file mode 100755 index 0000000000..eee86af1e9 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_39171-rename_IS02709_ElasticsearchMarcFormat_to_base64ISO2709.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "39171", + description => "Rename ElasticsearchMARCFormat syspref options", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ UPDATE systempreferences SET options = 'base64ISO2709|ARRAY' WHERE variable = 'ElasticsearchMARCFormat' }); + $dbh->do(q{ UPDATE systempreferences SET value = 'base64ISO2709' WHERE variable = 'ElasticsearchMARCFormat' AND value = 'ISO2709' }); + say $out "Renamed options for 'ElasticsearchMARCFormat' system preference"; + }, +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 2bf9d0b648..62ed4437de 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -234,7 +234,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'), ('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL), ('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL), -('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'), +('ElasticsearchMARCFormat', 'base64ISO2709', 'base64ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'), ('EmailAddressForPatronRegistrations', '', '', ' If you choose EmailAddressForPatronRegistrations you have to enter a valid email address: ', 'free'), ('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'), ('EmailFieldPrecedence','email|emailpro|B_email','','Ordered list of patron email fields to use when AutoEmailPrimaryAddress is set to first valid','multiple'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref index 18d21a955a..eac9b14907 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -304,9 +304,9 @@ Administration: - - "Elasticsearch MARC format: " - pref: ElasticsearchMARCFormat - default: "ISO2709" + default: "base64ISO2709" choices: - "ISO2709": "ISO2709 (exchange format)" + "base64ISO2709": "ISO2709 (exchange format)" "ARRAY": "Searchable array" -
ISO2709 format is recommended as it is faster and takes less space, whereas array format makes the full MARC record searchable. -
NOTE: Making the full record searchable may have a negative effect on relevance ranking of search results. diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t index 2b46b66d3a..8ee3ae0541 100755 --- a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t +++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t @@ -212,7 +212,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' plan tests => 70; t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); - t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', 'ISO2709' ); + t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', 'base64ISO2709' ); my @mappings = ( { @@ -744,7 +744,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' ok( !( defined $docs->[0]->{unimarc_title} ), "No mapping when marc_type doesn't match marc flavour" ); - # Marc serialization format fallback for records exceeding ISO2709 max record size + # Marc serialization format fallback for records exceeding base64ISO2709 max record size my $large_marc_record = MARC::Record->new(); $large_marc_record->leader(' cam 22 a 4500'); @@ -970,7 +970,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori plan tests => 5; t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); - t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', 'ISO2709' ); + t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', 'base64ISO2709' ); my $builder = t::lib::TestBuilder->new; my $auth_type = -- 2.39.5