We have seen this issue in a 17.11 installation, but not in a newer 18.11. I believe that Zebra version and using/not using ICU might play a role here. When looking into it, we were able to fix the issue removing the lines adding quotes to the search in Search.pm: http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Search.pm;h=4191cbc2de0e8530637cb2027b2a3de8374e0eef;hb=8427b684148944b9306fd4786c75c53527037024#l1722 The quotes appear to be the issue, as a simple search using mc-ccode: without quotes works. This problem has also been reported on the mailing list: https://lists.katipo.co.nz/pipermail/koha/2019-June/053081.html Setting to major as this effects a major feature in the OPAC.
I have just seen this in an 18.11.08 with ICU enabled. Not quoting the queries fixes it. My thought was to say if syspref ICU is on, don't quote the ccode queries. What do you think? Or is there something that needs changing in the ICU chains config?
Created attachment 92940 [details] [review] Bug 23086 - Search for collection is broken
Hi Kyle, could you add a bit of a description of the fix and a test plan please? Thx for taking this up!
*** Bug 24575 has been marked as a duplicate of this bug. ***
Created attachment 106664 [details] [review] 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 <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels> 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!
Created attachment 106668 [details] [review] 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 <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels> 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! Signed-off-by: Liz Rea <wizzyrea@gmail.com> https://bugs.koha-community.org/show_bug.cgi?id=23806
Created attachment 106855 [details] [review] 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 <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels> 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! Signed-off-by: Liz Rea <wizzyrea@gmail.com> https://bugs.koha-community.org/show_bug.cgi?id=23806 Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
The fix we use in production is a bit more radical than yours :) - if ( $k !~ /mc-i(tem)?type/ ) { - # 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."'"; - }
Can we expect a unit test to cover this change?
Created attachment 106935 [details] [review] Bug 23086: Unit test
Created attachment 106936 [details] [review] 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 <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels> 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! 16 - Check the zebra-output.log: Search biblios OK 0 1 1+0 RPN @attrset Bib-1 @attr 1=8009 NFIC 17 - Add a new ccode value: N)N 18 - Set some items to that ccode 19 - Confirm searching by that ccode works
(In reply to Jonathan Druart from comment #9) > Can we expect a unit test to cover this change? Added and updated patch Previous version didn't handle bad characters in the ccode well, using double quotes seems to work
Created attachment 107055 [details] [review] Bug 23086: Unit test Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 107056 [details] [review] 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 <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels> 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! 16 - Check the zebra-output.log: Search biblios OK 0 1 1+0 RPN @attrset Bib-1 @attr 1=8009 NFIC 17 - Add a new ccode value: N)N 18 - Set some items to that ccode 19 - Confirm searching by that ccode works Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 107355 [details] [review] Bug 23086: Unit test Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Created attachment 107356 [details] [review] 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 <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels> 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! 16 - Check the zebra-output.log: Search biblios OK 0 1 1+0 RPN @attrset Bib-1 @attr 1=8009 NFIC 17 - Add a new ccode value: N)N 18 - Set some items to that ccode 19 - Confirm searching by that ccode works Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
I have to say that TUs on t/db_dependent/Search.t fail on master with Zebra set up with ICU. So i launched the new TU after setting back Zebra to CHR: New test without the code failed: OK New test with the code passed: OK Passed QA
Pushed to master for 20.11, thanks to everybody involved!
backported to 20.05.x for 20.05.03
backported to 19.11.x for 19.11.09
Backported to 19.05.x branch for 19.05.15