107 |
|
|
108 |
$log->debug("results got params: " . Dumper( $params ) ); |
$log->debug("results got params: " . Dumper( $params ) ); |
109 |
|
|
110 |
|
if ($params->{_page} < 1) { |
111 |
|
$params->{_page} = 1; |
112 |
|
$log->warn("fixed _page parametar to 1"); |
113 |
|
} |
114 |
|
|
115 |
my @attr; |
my @attr; |
116 |
my @words; |
my @words; |
117 |
# default operator to join fields/words |
# default operator to join fields/words |
152 |
|
|
153 |
$log->die("can't find _template or default from configuration!") unless ($template); |
$log->die("can't find _template or default from configuration!") unless ($template); |
154 |
|
|
155 |
$log->debug("using template $template"); |
my $hits_on_page = $c->config->{'hyperestraier'}->{'hits_on_page'} || 10; |
156 |
|
|
157 |
|
$log->debug("using template $template to produce $hits_on_page results"); |
158 |
|
|
159 |
$c->stash->{html_results} = sub { |
$c->stash->{html_results} = sub { |
160 |
my $res = $webpac->search( |
my $res = $webpac->search( |
162 |
template => $template, |
template => $template, |
163 |
add_attr => \@attr, |
add_attr => \@attr, |
164 |
get_attr => [ '@uri' ], |
get_attr => [ '@uri' ], |
165 |
max => $c->config->{'hyperestraier'}->{'hits_on_page'}, |
max => $hits_on_page, |
166 |
page => $params->{'_page'}, |
page => $params->{'_page'}, |
167 |
); |
); |
168 |
# $log->debug("controller got " . ( $#{$res} + 1 ) . " results for '$q' " . Dumper( $res )); |
# $log->debug("controller got " . ( $#{$res} + 1 ) . " results for '$q' " . Dumper( $res )); |
169 |
return $res; |
return $res; |
170 |
}; |
}; |
171 |
|
|
172 |
$c->stash->{phrase} = $q; |
$c->stash->{phrase} = $q; |
173 |
$c->stash->{attr} = \@attr; |
$c->stash->{attr} = \@attr; |
174 |
|
$c->stash->{page} = $params->{'_page'}; |
175 |
|
$c->stash->{hits_on_page} = $hits_on_page; |
176 |
|
|
177 |
$c->stash->{template} = 'results.tt'; |
$c->stash->{template} = 'results.tt'; |
178 |
} |
} |