Basic reformat of section in Search.pm

In for loops, replace all-inclusive conditional blocks like:
    for (@foo) {
        if (test) {
            block;
        }
    }

with conditional use of "next":
    for (@foo) {
        test or next;
        block;
    }

This reduces the number of unnecessarily nested blocks, and the
overall number of lines.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Joe Atzberger 2009-01-09 15:42:27 -06:00 committed by Galen Charlton
parent cd16f12a47
commit 424eff89dd

View file

@ -499,38 +499,24 @@ sub getRecords {
#warn $servers[$i-1]."\n".$record; #.$facet_record->title(); #warn $servers[$i-1]."\n".$record; #.$facet_record->title();
if ($facet_record) { if ($facet_record) {
for ( my $k = 0 ; $k <= @$facets ; $k++ ) { for ( my $k = 0 ; $k <= @$facets ; $k++ ) {
($facets->[$k]) or next;
if ( $facets->[$k] ) { my @fields = map {$facet_record->field($_)} @{$facets->[$k]->{'tags'}} ;
my @fields;
for my $tag ( @{ $facets->[$k]->{'tags'} } )
{
push @fields,
$facet_record->field($tag);
}
for my $field (@fields) { for my $field (@fields) {
my @subfields = $field->subfields(); my @subfields = $field->subfields();
for my $subfield (@subfields) { for my $subfield (@subfields) {
my ( $code, $data ) = @$subfield; my ( $code, $data ) = @$subfield;
if ( $code eq ($code eq $facets->[$k]->{'subfield'}) or next;
$facets->[$k]->{'subfield'} ) $facets_counter->{ $facets->[$k]->{'link_value'} }->{$data}++;
{
$facets_counter->{ $facets->[$k]
->{'link_value'} }
->{$data}++;
} }
} }
} $facets_info->{ $facets->[$k]->{'link_value'} }->{'label_value'} =
$facets_info->{ $facets->[$k]
->{'link_value'} }->{'label_value'} =
$facets->[$k]->{'label_value'}; $facets->[$k]->{'label_value'};
$facets_info->{ $facets->[$k] $facets_info->{ $facets->[$k]->{'link_value'} }->{'expanded'} =
->{'link_value'} }->{'expanded'} =
$facets->[$k]->{'expanded'}; $facets->[$k]->{'expanded'};
} }
} }
} }
} }
}
$results_hashref->{ $servers[ $i - 1 ] } = $results_hash; $results_hashref->{ $servers[ $i - 1 ] } = $results_hash;
} }