Bugzilla – Attachment 181354 Details for
Bug 38694
Boost exact title matches in Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38694: (follow-up) Rename syspref from ESBoostFieldMatch to ElasticsearchBoostFieldMatch
Bug-38694-follow-up-Rename-syspref-from-ESBoostFie.patch (text/plain), 7.47 KB, created by
Thomas Klausner
on 2025-04-23 09:14:14 UTC
(
hide
)
Description:
Bug 38694: (follow-up) Rename syspref from ESBoostFieldMatch to ElasticsearchBoostFieldMatch
Filename:
MIME Type:
Creator:
Thomas Klausner
Created:
2025-04-23 09:14:14 UTC
Size:
7.47 KB
patch
obsolete
>From 2906dedd22f86b4377e0cb9ec6e29e4372a7bbbe Mon Sep 17 00:00:00 2001 >From: Thomas Klausner <domm@plix.at> >Date: Wed, 23 Apr 2025 09:10:28 +0000 >Subject: [PATCH] Bug 38694: (follow-up) Rename syspref from ESBoostFieldMatch > to ElasticsearchBoostFieldMatch > >to keep the syspref names consistent with the existings values. Also "ES" is not as self-documenting as "Elasticsearch". > >No code change, so the test plan stays the same. >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- > installer/data/mysql/atomicupdate/bug38694.pl | 6 +++--- > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../prog/en/modules/admin/preferences/searching.pref | 2 +- > .../Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 6 +++--- > 5 files changed, 9 insertions(+), 9 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index f454498bac..af854edf90 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -283,7 +283,7 @@ sub build_query_compat { > my @sort_params = $self->_convert_sort_fields(@$sort_by); > my @index_params = $self->_convert_index_fields(@$indexes); > my $field_match_boost_query = >- C4::Context->preference('ESBoostFieldMatch') >+ C4::Context->preference('ElasticsearchBoostFieldMatch') > ? $self->_build_field_match_boost_query( { operands => $operands, indexes => \@index_params } ) > : []; > $limits = $self->_fix_limit_special_cases($orig_limits); >diff --git a/installer/data/mysql/atomicupdate/bug38694.pl b/installer/data/mysql/atomicupdate/bug38694.pl >index e8a0846f93..7ff4cddcbd 100755 >--- a/installer/data/mysql/atomicupdate/bug38694.pl >+++ b/installer/data/mysql/atomicupdate/bug38694.pl >@@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_success say_info); > > return { > bug_number => "38694", >- description => "Add ESBoostFieldMatch system preference", >+ description => "Add ElasticsearchBoostFieldMatch system preference", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; >@@ -12,10 +12,10 @@ return { > $dbh->do( > q{ > INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >- ('ESBoostFieldMatch', '0', NULL, 'Add a "match" query to es when searching, will follow indexes chosen in advanced search, or use title-cover for generic keyword or title index search', 'YesNo') >+ ('ElasticsearchBoostFieldMatch', '0', NULL, 'Add a "match" query to es when searching, will follow indexes chosen in advanced search, or use title-cover for generic keyword or title index search', 'YesNo') > } > ); > >- say_success( $out, "Added new system preference 'ESBoostFieldMatch'" ); >+ say_success( $out, "Added new system preference 'ElasticsearchBoostFieldMatch'" ); > }, > }; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 764eed4f4d..8c8328fb58 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -231,6 +231,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('EDIFACT','0',NULL,'Enables EDIFACT acquisitions functions','YesNo'), > ('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice'), > ('EdifactLSQ', 'location', 'location|ccode', 'Map EDI sequence code (GIR+LSQ) to Koha Item field', 'Choice'), >+('ElasticsearchBoostFieldMatch', '0', NULL, 'Add a "match" query to es when searching, will follow indexes chosen in advanced search, or use title-cover for generic keyword or title index search', 'YesNo'), > ('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), >@@ -260,7 +261,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ERMProviderEbscoApiKey', '', '', 'API key for EBSCO', 'free'), > ('ERMProviderEbscoCustomerID', '', '', 'Customer ID for EBSCO', 'free'), > ('ERMProviders', 'local', 'local|ebsco', 'Set the providers for the ERM module', 'Choice'), >-('ESBoostFieldMatch', '0', NULL, 'Add a "match" query to es when searching, will follow indexes chosen in advanced search, or use title-cover for generic keyword or title index search', 'YesNo'), > ('ESPreventAutoTruncate', 'barcode|control-number|control-number-identifier|date-of-acquisition|date-of-publication|date-time-last-modified|identifier-standard|isbn|issn|itype|lc-card-number|number-local-acquisition|other-control-number|record-control-number', NULL, 'List of searchfields (separated by | or ,) that should not be autotruncated by Elasticsearch even if QueryAutoTruncate is set to Yes', 'free'), > ('ExcludeHolidaysFromMaxPickUpDelay', '0', NULL, 'If ON, reserves max pickup delay takes into accountthe closed days.', 'YesNo'), > ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index cf78ddd362..268343180c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -96,7 +96,7 @@ Searching: > - "the cross_fields option for Elasticsearch searches, supported in Elasticsearch 6.X and above." > - See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-cross-fields">Elasticsearch cross_fields documentation</a>. > - >- - pref: ESBoostFieldMatch >+ - pref: ElasticsearchBoostFieldMatch > default: 0 > choices: > 1: Enable >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >index 7e9ff54957..5b64de2d8e 100755 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >@@ -1234,8 +1234,8 @@ subtest "_build_field_match_boost_query() tests" => sub { > 'Title is not converted to title-cover' > ); > >- t::lib::Mocks::mock_preference( 'ESBoostFieldMatch', '0' ); >- t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); >+ t::lib::Mocks::mock_preference( 'ElasticsearchBoostFieldMatch', '0' ); >+ t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); > my ( undef, $query ) = $qb->build_query_compat( ['AND'], [ 'donald duck', 'disney' ], [ 'title', 'author' ] ); > is( > $query->{query}{bool}{must}[0]{query_string}{query}, >@@ -1248,7 +1248,7 @@ subtest "_build_field_match_boost_query() tests" => sub { > 'No should query added for boosting' > ); > >- t::lib::Mocks::mock_preference( 'ESBoostFieldMatch', '1' ); >+ t::lib::Mocks::mock_preference( 'ElasticsearchBoostFieldMatch', '1' ); > ( undef, $query ) = $qb->build_query_compat( ['AND'], [ 'donald duck', 'disney' ], [ 'title', 'author' ] ); > is_deeply( > $query->{query}{bool}{should}, >-- >2.39.5
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 38694
:
175423
|
175459
|
175840
|
175841
|
175842
|
179940
|
179941
|
179969
|
179970
|
180057
|
180058
|
180325
|
180326
|
181352
|
181353
| 181354