From f6ac8c0aa8bd448a52b888c9c225c6c57f0221da Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 9 Apr 2010 02:16:56 +0000 Subject: [PATCH] throw away single ampersand and pipe git-svn-id: svn://svn.open-ils.org/ILS/trunk@16188 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Storage/QueryParser.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm index cc4dc5425..948346b1c 100755 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm @@ -622,15 +622,17 @@ sub decompose { my $atom = $1; my $after = $'; - my $class_node = $struct->classed_node($current_class); + $_ = $after; + $last_type = ''; + my $negator = ($atom =~ s/^-//o) ? '!' : ''; my $truncate = ($atom =~ s/\*$//o) ? '*' : ''; - $class_node->add_fts_atom( $atom, suffix => $truncate, prefix => $negator, node => $class_node ); - $struct->joiner( '&' ); - - $_ = $after; - $last_type = ''; + if (!grep { $atom eq $_ } ('&','|')) { # throw away & and |, not allowed in tsquery, and not really useful anyway + my $class_node = $struct->classed_node($current_class); + $class_node->add_fts_atom( $atom, suffix => $truncate, prefix => $negator, node => $class_node ); + $struct->joiner( '&' ); + } } last unless ($_); -- 2.11.0