Bug 22524: Fix date/time-last-modified search with Elasticsearch
authorEre Maijala <ere.maijala@helsinki.fi>
Mon, 29 Apr 2019 08:03:22 +0000 (11:03 +0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 26 Jul 2019 15:16:34 +0000 (16:16 +0100)
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 <wizzyrea@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
installer/data/mysql/atomicupdate/bug_22524.perl [new file with mode: 0644]

index cde1249..5c4eb62 100644 (file)
@@ -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 (file)
index 0000000..af765f8
--- /dev/null
@@ -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