Bug 37057: Restore filtering of unused authorities

Bug 12478 commented this code out, however, we do return the 'used' parameter in ES authority searches. While
we should implement the feature for both ES and Zebra as an index, we can restore this behaviour here.

To test:
1 - Search authorities on OPAC with SearchEngine syspref set to both Elasticsearch and Zebra
    I just searched for 'a'
2 - Confirm results with no usage are included
3 - Test with both values of OPACShowUnusedAuthorities
4 - Apply patch
5 - Repeat searches with both engines and syspref settings
6 - Confirm unused authorities not shown in either engine when syspref is "Don't show"
7 - Conifrm unused authorities shown in both engines when syspref is "Show"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 30acbb2604)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-06-11 12:29:13 +00:00 committed by Lucas Gass
parent c2b54df8d5
commit 9537ba5957
1 changed files with 5 additions and 5 deletions

View File

@ -129,8 +129,6 @@ if ( $op eq "do_search" ) {
}
}
$template->param( result => $results ) if $results;
$template->param(
pagination_bar => pagination_bar(
$base_url, int( $total / $resultsperpage ) + 1,
@ -142,11 +140,13 @@ if ( $op eq "do_search" ) {
);
unless (C4::Context->preference('OPACShowUnusedAuthorities')) {
# TODO implement usage counts
# my @usedauths = grep { $_->{used} > 0 } @$results;
# $results = \@usedauths;
# TODO implement usage counts in the indexes to filter during searching
my @usedauths = grep { $_->{used} > 0 } @$results;
$results = \@usedauths;
}
$template->param( result => $results ) if $results;
# Opac search history
if (C4::Context->preference('EnableOpacSearchHistory')) {
if ( $startfrom == 1) {