From a3db9056ad29e7900f4eae776a5adce66c1ae258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Tue, 23 May 2023 10:27:24 +0200 Subject: [PATCH] Bug 33802: On OPAC authority detail page, usage count in erroneous If QueryAutoTruncate is enabled, the biblio usage count of an authority displayed on OPAC may be wrong. This is due to the fact that the authid search being automatically truncated, a search for biblios using authority 22 will retrieved also biblios using authorities 222, 22*. TO TEST: 1. On a Koha with authorities, enable QueryAutoTruncate. 2. Go on opac-authoritiesdetail.pl page for an authority with the lowest possible authid. Let say 1. 3. Confirm that you have a large biblios usage count, and that by clicking on the link to see linked biblios, you get far less biblios than expected. 4. Apply the patch. Repeat 2-3. Signed-off-by: David Nind --- Koha/Authorities.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Authorities.pm b/Koha/Authorities.pm index 9d29346787..3345108a0c 100644 --- a/Koha/Authorities.pm +++ b/Koha/Authorities.pm @@ -51,7 +51,7 @@ sub get_usage_count { my $authid = $params->{authid} || return; my $searcher = Koha::SearchEngine::Search->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); - my ( $err, $result, $count ) = $searcher->simple_search_compat( 'an:' . $authid, 0, 0 ); + my ( $err, $result, $count ) = $searcher->simple_search_compat( "an:\"$authid\"", 0, 0 ); if( $err ) { warn "Error: $err from search for " . $authid; return; -- 2.30.2