From 829139111d66e7049dbe4f603c90706ce678431c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 6 Aug 2021 17:01:38 +0100 Subject: [PATCH] Bug 11175: (QA follow-up) Fix queries --- Koha/Biblio.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index b84f8e21ce..5870ddea65 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -538,22 +538,24 @@ sub get_analytics_query { my $pf001 = $marc->field('001') || undef; if ( defined($pf001) ) { + $searchstr = "("; my $pf003 = $marc->field('003') || undef; if ( !defined($pf003) ) { # search for 773$w='Host001' - $searchstr = "rcn:" . $pf001->data(); + $searchstr .= "rcn:" . $pf001->data(); } else { - $searchstr = "("; - # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') + $searchstr .= "("; + # search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001' $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")"; - $searchstr .= " OR rcn:" . $pf003->data() . " " . $pf001->data(); + $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\""; $searchstr .= ")"; } # limit to monograph and serial component part records $searchstr .= " AND (bib-level:a OR bib-level:b)"; + $searchstr .= ")"; } } else { -- 2.20.1