From 181dab6699962cc460e2296206c5f901e31f9fd7 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 14 Mar 2013 14:02:26 -0400 Subject: [PATCH] Bug 9239 QA follow-up: fix overeager quote escaping The quote escaping added two follow-ups ago was a little too eager, and escaped perfectly valid quotes in some instances. This patch moves the escaping deeper into the loop so that no needed quotes will be escaped. Signed-off-by: Katrin Fischer Test plan included here, as this is the last patch in the series: All tests pass. OPAC Simple search - Keyword searches using boolean operators || and && - OK - Pubdate searches using pubdate() - OK - Using different search options: keyword, title, etc. - OK Facets - limit to available from a query parser simple search - OK - Other facets - OK Advanced search - Date range search - OK - Itemtype limits - OK - Language limit - OK - Combining various serach options with and without 'more' options and using boolean operators - OK Authorities - Searching for partial and complete names like "M", "Benedictus" works. - OK - Biblio count isc correct - OK - Links to linked biblios work. - OK. INTRANET Staged MARC import - Import records using various matching points - OK Serials - Search for a serial in subscription form - OK Acquisitions - Search for existing record from basket - OK Authorities - Running the linker script with QP on works. - OK - Searching for authorities works. - OK - Biblio count isc correct - OK - Links to linked biblios work. - OK. NOTE: As agreed with Jared in chat, query parser should be off by default for the next release. Signed-off-by: Jared Camins-Esakov --- Koha/QueryParser/Driver/PQF/query_plan/node.pm | 1 - Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/QueryParser/Driver/PQF/query_plan/node.pm b/Koha/QueryParser/Driver/PQF/query_plan/node.pm index 2695058b51..7d05937387 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/node.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/node.pm @@ -67,7 +67,6 @@ sub target_syntax { if (ref($atom)) { $atom_content = $atom->target_syntax($server); if ($atom_content) { - $atom_content =~ s/"/\\"/g; $pqf .= ' @or ' x (scalar(@fields) - 1); foreach my $attributes (@fields) { $attributes->{'attr_string'} ||= ''; diff --git a/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm b/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm index 6a69c353f2..8de250dbf9 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm @@ -22,7 +22,10 @@ directly. sub target_syntax { my ($self, $server) = @_; - return ' "' . $self->content . '" '; + my $content = $self->content; + $content =~ s/"/\\"/g; + + return ' "' . $content . '" '; } 1; -- 2.39.5