From 8fd14b9b6b6e41cd3242948ba3fa7b8d165af446 Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 5 Feb 2016 16:09:45 +1100 Subject: [PATCH] Bug 15745: C4::Matcher gets CCL parsing error if term contains ? (question mark) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Olli-Antti Kivilahti Also fixes ! and + Rebased to master Signed-off-by: Tomas Cohen Arazi It makes perfect sense and works as expected. This part of the code is too under-tested so no point requiring a regression test for such a simple change. Signed-off-by: Brendan A Gallagher (cherry picked from commit fcbd81049f590e5fc0c31030bcdb1311951c1444) Signed-off-by: Julian Maurice (cherry picked from commit 7212c9f41e635a3be54dc2356696b1e9ce6a370f) Signed-off-by: Frédéric Demians --- C4/Matcher.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 0dd87828ef..a59ba673e5 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -656,7 +656,8 @@ sub get_matches { else { my $phr = C4::Context->preference('AggressiveMatchOnISBN') ? ',phr' : q{}; $query = join( " or ", - map { "$matchpoint->{'index'}$phr=$_" } @source_keys ); + map { "$matchpoint->{'index'}$phr=\"$_\"" } @source_keys ); + #NOTE: double-quote the values so you don't get a "Embedded truncation not supported" error when a term has a ? in it. } require C4::Search; @@ -812,7 +813,7 @@ sub _get_match_keys { } else { foreach my $subfield ($field->subfields()) { if (exists $component->{'subfields'}->{$subfield->[0]}) { - $string .= " " . $subfield->[1]; + $string .= " " . $subfield->[1]; #FIXME: It would be better to create an array and join with a space later... } } } -- 2.39.5