182 |
my $swish = SWISH::API->new( "$dir/../var/swish/$database" ); |
my $swish = SWISH::API->new( "$dir/../var/swish/$database" ); |
183 |
$swish->abort_last_error if $swish->Error; |
$swish->abort_last_error if $swish->Error; |
184 |
|
|
|
my $pager = Data::Page->new; |
|
|
$pager->$_( param($_) ) foreach ( qw/entries_per_page current_page/ ); |
|
|
|
|
|
dump_yaml( 'pager', $pager ); |
|
|
|
|
185 |
my @search = (); |
my @search = (); |
186 |
if ( $search =~ m{(=|"|AND|OR)} ) { |
if ( $search =~ m{(=|"|AND|OR)} ) { |
187 |
push @search, $search; |
push @search, $search; |
219 |
|
|
220 |
dump_yaml( 'swish_results', $swish_results ); |
dump_yaml( 'swish_results', $swish_results ); |
221 |
|
|
222 |
|
my $pager = Data::Page->new; |
223 |
|
$pager->$_( param($_) ) foreach ( qw/entries_per_page current_page/ ); |
224 |
$pager->total_entries( $swish_results->hits ); |
$pager->total_entries( $swish_results->hits ); |
225 |
|
|
226 |
$swish_results->seek_result( $pager->first ); |
dump_yaml( 'pager', $pager ); |
227 |
|
|
228 |
|
$swish_results->seek_result( $pager->first - 1 ); |
229 |
|
|
230 |
if ( ! $pager->total_entries ) { |
if ( ! $pager->total_entries ) { |
231 |
my $no_results = 'No results for search <b>%s</b>'; |
my $no_results = 'No results for search <b>%s</b>'; |
240 |
|
|
241 |
print qq|<ul class="pager">$pager_html</ul>\n\n| if $pager_html; |
print qq|<ul class="pager">$pager_html</ul>\n\n| if $pager_html; |
242 |
|
|
243 |
my $start = $pager->first; |
my $nr = $pager->first; |
244 |
print qq|<ol start=$start>\n|; |
print qq|<ol start=$nr>\n|; |
245 |
|
|
246 |
my $limit = $pager->entries_on_this_page; |
my $limit = $pager->entries_on_this_page; |
247 |
|
|
248 |
while ( my $result = $swish_results->next_result ) { |
while ( my $result = $swish_results->next_result ) { |
|
last if $limit-- == 0; |
|
249 |
|
|
250 |
my $data = from_json $result->property('data'); |
my $data = from_json $result->property('data'); |
251 |
|
|
266 |
print qq|<div><label>$label</label><span class=$attr>$v</span></div>\n|; |
print qq|<div><label>$label</label><span class=$attr>$v</span></div>\n|; |
267 |
} |
} |
268 |
print qq|</li>\n|; |
print qq|</li>\n|; |
269 |
|
|
270 |
|
last if $nr++ == $pager->last; |
271 |
} |
} |
272 |
print qq|</ol>\n\n|; |
print qq|</ol>\n\n|; |
273 |
|
|