From e3b249bcca7eae1b79bd75bdcd88388bb38e1874 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 14 May 2013 15:33:54 -0400 Subject: [PATCH] LP#118066: fix searches that failed because punctuation was a token in query When building the text array literal to pass to evergreen.rel_bump, make sure that tokens that get {search_}normalize{d} away don't result in syntax errors. With this patch, searches like the following will work again: keyword:Take me to the river / Al Green and Mabon Signed-off-by: Galen Charlton Signed-off-by: Lebbeous Fogle-Weekley --- .../OpenILS/Application/Storage/Driver/Pg/QueryParser.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index c202dac4b9..4fcbe5ee74 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -904,9 +904,9 @@ sub flatten { if(scalar @bumps > 0 && scalar @{$node->only_positive_atoms} > 0) { # Note: Previous rank function used search_normalize outright. Duplicating that here. - $node_rank .= "\n" . ${spc} x 5 . "* evergreen.rel_bump(('{' || search_normalize("; - $node_rank .= join(") || ',' || search_normalize(",map { $self->QueryParser->quote_phrase_value($_->content) } @{$node->only_positive_atoms}); - $node_rank .= ") || '}')::TEXT[], " . $node->table_alias . ".value, '{" . join(",",@bumps) . "}'::TEXT[], '{" . join(",",@bumpmults) . "}'::NUMERIC[])"; + $node_rank .= "\n" . ${spc} x 5 . "* evergreen.rel_bump(('{' || quote_literal(search_normalize("; + $node_rank .= join(")) || ',' || quote_literal(search_normalize(",map { $self->QueryParser->quote_phrase_value($_->content) } @{$node->only_positive_atoms}); + $node_rank .= ")) || '}')::TEXT[], " . $node->table_alias . ".value, '{" . join(",",@bumps) . "}'::TEXT[], '{" . join(",",@bumpmults) . "}'::NUMERIC[])"; } my $NOT = ''; -- 2.43.2