Bug 25278: Retrieve correct search fields for authorities
authorNick Clemens <nick@bywatersolutions.com>
Fri, 24 Apr 2020 15:52:50 +0000 (15:52 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 18 May 2020 14:28:33 +0000 (15:28 +0100)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/SearchEngine/Elasticsearch.pm
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm

index b6b3be0..7afb9aa 100644 (file)
@@ -383,8 +383,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?
 }
index 1bbbf07..871f81d 100644 (file)
@@ -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