QueryParser: Provide null rank query as default
authorThomas Berezansky <tsbere@mvlc.org>
Sun, 17 Feb 2013 00:03:27 +0000 (19:03 -0500)
committerBen Shum <bshum@biblio.org>
Mon, 25 Feb 2013 16:40:21 +0000 (11:40 -0500)
If a given node contains only negative atoms the rank query was coming out as
an empty string, which was generating bad SQL. This causes the default to be a
null tsquery instead.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 8914bd1..6e80ba4 100644 (file)
@@ -1559,6 +1559,7 @@ sub tsquery_rank {
         push @atomlines, "\n" . ${spc} x 3 . $atom->sql;
     }
     $self->{tsquery_rank} = join(' ||', @atomlines);
+    $self->{tsquery_rank} = 'NULL::tsquery' unless $self->{tsquery_rank};
     return $self->{tsquery_rank};
 }