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> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
de73925929
commit
181267bd2b
|
|
@ -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} } ) {
|
||||
|
|
|
|||
1
about.pl
1
about.pl
|
|
@ -341,6 +341,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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
@ -178,6 +178,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'),
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
||||
|
|
@ -382,6 +385,12 @@
|
|||
integration. This feature will be removed from Koha in a short term.
|
||||
</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 %]
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,14 @@ Searching:
|
|||
yes: Enable
|
||||
no: Disable
|
||||
- "browsing search results from the bibliographic record detail page in staff interface."
|
||||
-
|
||||
- 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:
|
||||
-
|
||||
- pref : LoadSearchHistoryToTheFirstLoggedUser
|
||||
|
|
|
|||
Loading…
Reference in New Issue