LP1779392: Stop sending broken queries
authorJason Boyer <jboyer@library.in.gov>
Fri, 29 Jun 2018 18:09:51 +0000 (14:09 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 6 Jul 2018 16:50:51 +0000 (12:50 -0400)
It's possible to send invalid parameters to the
search.highlight_display_fields function which
wastes a db roundtrip and fills the logs with
errors. Checking to be sure there's anything in
the parameter will prevent both.

Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index ca3f85a..d0c6bc4 100644 (file)
@@ -1317,9 +1317,8 @@ sub fetch_display_fields {
         return;
     }
 
-    my $hl_map_string = "''::HSTORE";
+    my $hl_map_string = "";
     if (ref($highlight_map) =~ /HASH/) {
-        $hl_map_string = "";
         for my $tsq (keys %$highlight_map) {
             my $field_list = join(',', @{$$highlight_map{$tsq}});
             $hl_map_string .= ' || ' if $hl_map_string;
@@ -1330,7 +1329,7 @@ sub fetch_display_fields {
     my $e = new_editor();
 
     for my $record ( @records ) {
-        next unless $record;
+        next unless ($record && $hl_map_string);
         $conn->respond(
             $e->json_query(
                 {from => ['search.highlight_display_fields', $record, $hl_map_string]}