From 5d27fb71cbd91fdf196b6568a590f2eef54d7cd1 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Mon, 29 Apr 2019 11:03:22 +0300 Subject: [PATCH] Bug 22524: Fix date/time-last-modified search with Elasticsearch Avoid using slash in the field name since it would need to be escaped. Fix conversion of dtlm and any existing mapping. Signed-off-by: Liz Rea Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- installer/data/mysql/atomicupdate/bug_22524.perl | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22524.perl diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index cde124940b..5c4eb62463 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -546,7 +546,7 @@ our %index_field_convert = ( 'pubdate' => 'date-of-publication', 'acqdate' => 'date-of-acquisition', 'date/time-last-modified' => 'date-time-last-modified', - 'dtlm' => 'date/time-last-modified', + 'dtlm' => 'date-time-last-modified', 'diss' => 'dissertation-information', 'nb' => 'isbn', 'ns' => 'issn', diff --git a/installer/data/mysql/atomicupdate/bug_22524.perl b/installer/data/mysql/atomicupdate/bug_22524.perl new file mode 100644 index 0000000000..af765f8e60 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22524.perl @@ -0,0 +1,8 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "UPDATE `search_field` SET `name` = 'date-time-last-modified', `label` = 'date-time-last-modified' WHERE `name` = 'date/time-last-modified'" ); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 22524 - Fix date/time-last-modified search with Elasticsearch)\n"; +} \ No newline at end of file -- 2.39.5