Makes a warning go away when running fts-replacement.pl, but may have...
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 21 May 2012 18:22:40 +0000 (14:22 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 21 May 2012 19:22:55 +0000 (15:22 -0400)
...consequences.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 793a38d..3e9d10e 100644 (file)
@@ -757,9 +757,17 @@ sub flatten {
                 if (@{$node->fields} > 0) {
                     @bump_fields = @{$node->fields};
 
-                    my @field_ids;
-                    push(@field_ids, $self->QueryParser->search_field_ids_by_class( $node->classname, $_ )->[0]) for (@bump_fields);
-                    $from .= "\n\t\t\tWHERE fe_weight.id IN  (". join(',', @field_ids) .")";
+                    my @field_ids = grep defined, (
+                        map {
+                            $self->QueryParser->search_field_ids_by_class(
+                                $node->classname, $_
+                            )->[0]
+                        } @bump_fields
+                    );
+                    if (@field_ids) {
+                        $from .= "\n\t\t\tWHERE fe_weight.id IN  (" .
+                            join(',', @field_ids) . ")";
+                    }
 
                 } else {
                     @bump_fields = @{$self->QueryParser->search_fields->{$node->classname}};