From e522e32ea3bd826d068197428b8314811a967511 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Thu, 14 Feb 2019 16:52:04 +0100 Subject: [PATCH] Bug 19575: Keep authority-number as alias and fix query Keep authority-number as alias and change field name from alias to real field in hard coded Elasticsearch query Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit eeda2afd3a710cbf4115b96f1386294df7693252) Signed-off-by: Martin Renvoize --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + Koha/SearchEngine/Elasticsearch/Search.pm | 2 +- ...575-use-canonical-field-names-and-resolve-aliased-fields.sql | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 7feb6e25c6..c65a4b56dd 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -557,6 +557,7 @@ our %index_field_convert = ( 'se' => 'title-series', 'ut' => 'title-uniform', 'an' => 'koha-auth-number', + 'authority-number' => 'koha-auth-number', 'at' => 'authtype', 'he' => 'heading', 'rank' => 'relevance', diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index ea166b597e..3436174250 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -266,7 +266,7 @@ sub count_auth_use { query => { bool => { # query => { match_all => {} }, - filter => { term => { 'authority-number' => $authid } } + filter => { term => { 'koha-auth-number' => $authid } } } } }; diff --git a/installer/data/mysql/atomicupdate/bug_19575-use-canonical-field-names-and-resolve-aliased-fields.sql b/installer/data/mysql/atomicupdate/bug_19575-use-canonical-field-names-and-resolve-aliased-fields.sql index 3c825d64e6..6285c868a6 100644 --- a/installer/data/mysql/atomicupdate/bug_19575-use-canonical-field-names-and-resolve-aliased-fields.sql +++ b/installer/data/mysql/atomicupdate/bug_19575-use-canonical-field-names-and-resolve-aliased-fields.sql @@ -7,7 +7,7 @@ UPDATE `search_field` SET `name` = 'control-number', `label` = 'control-number' UPDATE `search_field` SET `name` = 'place-of-publication', `label` = 'place-of-publication' WHERE `name` = 'place'; UPDATE `search_field` SET `name` = 'date-of-acquisition', `label` = 'date-of-acquisition' WHERE `name` = 'acqdate'; UPDATE `search_field` SET `name` = 'isbn', `label` = 'isbn' WHERE `name` = 'isbn'; -UPDATE `search_field` SET `name` = 'authority-number', `label` = 'authority-number' WHERE `name` = 'an'; +UPDATE `search_field` SET `name` = 'koha-auth-number', `label` = 'koha-auth-number' WHERE `name` = 'an'; UPDATE `search_field` SET `name` = 'subject', `label` = 'subject' WHERE `name` = 'subject'; UPDATE `search_field` SET `name` = 'publisher', `label` = 'publisher' WHERE `name` = 'publisher'; UPDATE `search_field` SET `name` = 'record-source', `label` = 'record-source' WHERE `name` = 'record-source'; -- 2.39.5