43 |
|
|
44 |
my $v = $params->{$f} || next; |
my $v = $params->{$f} || next; |
45 |
|
|
|
push @attr, $f; |
|
46 |
$q .= "$v "; |
$q .= "$v "; |
47 |
|
|
48 |
|
next if ($f eq 'all'); # don't add_attr for magic field all |
49 |
|
|
50 |
|
if ($v !~ /\s/) { |
51 |
|
push @attr, "$f ISTRINC $v"; |
52 |
|
} else { |
53 |
|
map { push @attr, "$f ISTRINC $_"; } split(/\s+/, $v); |
54 |
|
} |
55 |
} |
} |
56 |
|
|
57 |
$c->stash->{results} = sub { |
# strip spaces from beginning and end |
58 |
my $res = $webpac->search( $q ); |
$q =~ s/^\s+//; |
59 |
$log->debug("controller got " . ( $#{$res} + 1 ) . " results for '$q'"); |
$q =~ s/\s+$//; |
60 |
|
|
61 |
|
$c->stash->{html_results} = sub { |
62 |
|
my $res = $webpac->search( $q, $params->{'_template'}, \@attr ); |
63 |
|
# $log->debug("controller got " . ( $#{$res} + 1 ) . " results for '$q' " . Dumper( $res )); |
64 |
return $res; |
return $res; |
65 |
}; |
}; |
66 |
|
|
67 |
|
$c->stash->{phrase} = $q; |
68 |
|
|
69 |
$c->stash->{template} = 'results.tt'; |
$c->stash->{template} = 'results.tt'; |
70 |
} |
} |
71 |
|
|