From 1a0df6b40b46a0bffe0f5d70a1949bc9b2373c44 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 24 Apr 2020 15:52:50 +0000 Subject: [PATCH] Bug 25278: Retrieve correct search fields for authorities Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- Koha/SearchEngine/Elasticsearch.pm | 6 ++++-- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 3517b3bcec..df23725820 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -332,8 +332,10 @@ sub reset_elasticsearch_mappings { } my $cache = Koha::Caches->get_instance(); - $cache->clear_from_cache('elasticsearch_search_fields_staff_client'); - $cache->clear_from_cache('elasticsearch_search_fields_opac'); + $cache->clear_from_cache('elasticsearch_search_fields_staff_client_biblios'); + $cache->clear_from_cache('elasticsearch_search_fields_opac_biblios'); + $cache->clear_from_cache('elasticsearch_search_fields_staff_client_authorities'); + $cache->clear_from_cache('elasticsearch_search_fields_opac_authorities'); # FIXME return the mappings? } diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 1bbbf079b8..871f81d027 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -1139,7 +1139,7 @@ sub _search_fields { subfield => undef, }; my $cache = Koha::Caches->get_instance(); - my $cache_key = 'elasticsearch_search_fields' . ($params->{is_opac} ? '_opac' : '_staff_client'); + my $cache_key = 'elasticsearch_search_fields' . ($params->{is_opac} ? '_opac' : '_staff_client') . "_" . $self->index; my $search_fields = $cache->get_from_cache($cache_key, { unsafe => 1 }); if (!$search_fields) { # The reason we don't use Koha::SearchFields->search here is we don't -- 2.39.5