From bf01709c95655fb5b9b216f7e87595ad9239ecdd Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 18 Sep 2019 10:28:33 -0400 Subject: [PATCH] Bug 23086 - Search for collection is broken It appears that we are quoting the ccode values deep in the search code. Under ICU chains this breaks searching by limits To recreate 1 - Setup Koha using Zebra and icuchains 2 - Add ccode to AdvancedSearchTypes 3 - In koha-conf.xml set zebra debug level to include request none,fatal,warn,request,info 4 - Set some items into different ccodes 5 - On opac perform a search for: ccode:NFIC 6 - It works 7 - tail -n 50 /var/log/koha/kohadev/zebra-output.log 8 - Note search request like: Search biblios OK 26 1 1+0 RPN @attrset Bib-1 @attr 1=8009 NFIC 9 - On opac go to advanced search, select Collection, and limit to smae code a s above 10 - No results 11 - Check the zebra-output.log: Search biblios OK 0 1 1+0 RPN @attrset Bib-1 @attr 1=8009 'NFIC' 12 - Apply patch 13 - Restart all 14 - Repeat search by collection limit 15 - Success! --- C4/Search.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 6103af2d04..945b823816 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1529,10 +1529,10 @@ sub buildQuery { # OR every member of the group elsif ( $this_limit =~ /mc/ ) { my ($k,$v) = split(/:/, $this_limit,2); - if ( $k !~ /mc-i(tem)?type/ ) { + if ( $k !~ /mc-i(tem)?type/ && $v !~ /[a-zA-Z0-9]/ ) { # in case the mc-ccode value has complicating chars like ()'s inside it we wrap in quotes - $this_limit =~ tr/"//d; - $this_limit = $k.":'".$v."'"; + $v =~ tr/"//d; + $this_limit = qq{$k:'$v'}; } $group_OR_limits{$k} .= " or " if $group_OR_limits{$k}; -- 2.11.0