Bugzilla – Attachment 114881 Details for
Bug 27252
ES5 no longer supported (since 20.11.00)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[20.05 and earlier] Bug 27252: Add deprecation warning, cross_fields pref, and add version to ES info
2005-and-earlier-Bug-27252-Add-deprecation-warning.patch (text/plain), 7.38 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-01-05 14:55:22 UTC
(
hide
)
Description:
[20.05 and earlier] Bug 27252: Add deprecation warning, cross_fields pref, and add version to ES info
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-01-05 14:55:22 UTC
Size:
7.38 KB
patch
obsolete
>From a5ad20bae54fbc739fd77f4d35a0fa22d6cf8d48 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 16 Dec 2020 18:50:55 +0000 >Subject: [PATCH] [20.05 and earlier] Bug 27252: Add deprecation warning, > cross_fields pref, and add version to ES info > >This patch prepares Koha to officially no longer support Elasticsearch 5.X > >It adds a new system preference 'ElasticsearchCrossFields' to allow users to choose whether or not >to enable this feature > >It updates the about page to add a deprecation warning if a site is running ES5 > >To test: > 1 - Be running Koha with Elasticsearch 5.X > 2 - Attempt to search > Error: Unable to perform your search. Please try again. > 3 - Apply patch > 4 - Update database > 5 - Searching works > 6 - Find syspref 'ElasticsearchCrossFields' > 7 - Enable it > 8 - Searching is now broken > 9 - Check the about page > 10 - you can now see the Elasticsearch version > 11 - The systeminformation tab has a deprectaion warning > 12 - Set SearchEngine preference to 'Zebra' > 13 - View the about page - no warnings > 14 - Test again with ES6 - searching should "work" with either pref setting > 15 - There should be no warning on about pages > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- > about.pl | 1 + > ...ug_27252_add_ElasticsearchCrossFields_preference.perl | 9 +++++++++ > installer/data/mysql/sysprefs.sql | 1 + > koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 9 +++++++++ > .../prog/en/modules/admin/preferences/searching.pref | 8 ++++++++ > 6 files changed, 29 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug_27252_add_ElasticsearchCrossFields_preference.perl > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index eb86e5a30d..313c6d4c82 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -100,9 +100,9 @@ sub build_query { > fields => $fields, > lenient => JSON::true, > analyze_wildcard => JSON::true, >- type => 'cross_fields', > } > }; >+ $res->{query}->{query_string}->{type} = 'cross_fields' if C4::Context->preference('ElasticsearchCrossFields'); > > if ( $options{sort} ) { > foreach my $sort ( @{ $options{sort} } ) { >diff --git a/about.pl b/about.pl >index ad85b6aadb..fdf5fa567b 100755 >--- a/about.pl >+++ b/about.pl >@@ -335,6 +335,7 @@ if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { > # fetch the list of available indexes (e.g. plugins, etc) > $es_status->{nodes} = $es_conf->{nodes}; > my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} }); >+ my $es_status->{version} = $es->info->{version}->{number}; > > foreach my $index ( @indexes ) { > my $count; >diff --git a/installer/data/mysql/atomicupdate/Bug_27252_add_ElasticsearchCrossFields_preference.perl b/installer/data/mysql/atomicupdate/Bug_27252_add_ElasticsearchCrossFields_preference.perl >new file mode 100644 >index 0000000000..e4cfc8145a >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_27252_add_ElasticsearchCrossFields_preference.perl >@@ -0,0 +1,9 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ # you can use $dbh here like: >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo') >+ }); >+ NewVersion( $DBversion, 27252, "Add ElasticsearchCrossFields system preference"); >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index e6df1b608a..ed8f057d2a 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -174,6 +174,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('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'), >+('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'), > ('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'), > ('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'), > ('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that new purchase suggestions will be sent to: ','Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 7448d4094c..b3b7b4cd81 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -55,6 +55,9 @@ > <td><span class="status_warn">[% elasticsearch_fatal_config_error | html %]</span></td> > [% ELSE %] > <td> >+ Version: >+ <span>[% elasticsearch_status.version | html %]</span> >+ | > Nodes: > <span>[% elasticsearch_status.nodes.join(' / ') | html %]</span> > | >@@ -335,6 +338,12 @@ > Some system preferences have badly formatted YAML content: [% bad_yaml_prefs.join(', ') | html %] > </td></tr> > [% END %] >+ [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' && elasticsearch_status.version.substr(0,1) < 6 %] >+ <tr><th scope="row"><strong>Deprecation warning</strong></th><td> >+ Elasticsearch version 5.x is not supported in Koha 20.11 and greater. Please upgrade your Elasticsearch cluster >+ </td></tr> >+ [% END %] >+ > </table> > [% END %] > >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 9301c59ce7..c61915d475 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 >@@ -86,6 +86,14 @@ Searching: > yes: Enable > no: Disable > - "browsing search results from the bibliographic record detail page in staff client." >+ - >+ - pref: ElasticsearchCrossFields >+ default: 0 >+ choices: >+ yes: Enable >+ no: Disable >+ - "the cross_fields option for Elasticsearch searches, supported in Elasticsearch 6.X and above." >+ - "See documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-cross-fields" > Search form: > - > - Load the unlogged history to the next user. >-- >2.30.0
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 27252
:
114466
|
114553
|
114672
|
114673
|
114878
| 114881 |
114882