148 |
|
|
149 |
|
|
150 |
foreach my $p (@{$pager->pages_in_set()}) { |
foreach my $p (@{$pager->pages_in_set()}) { |
151 |
next if ($p < 0); |
next if ($p <= 0); |
152 |
if($p == $pager->current_page()) { |
if($p == $pager->current_page()) { |
153 |
$pager_jump .= "<b>$p</b> "; |
$pager_jump .= "<b>$p</b> "; |
154 |
} else { |
} else { |
359 |
$tmpl->param('full',0); |
$tmpl->param('full',0); |
360 |
} |
} |
361 |
|
|
362 |
|
my $swish_msg = ' '; |
363 |
|
|
364 |
# create new swish instance |
# create new swish instance |
365 |
my $swish = SWISH::API->new($INDEX); |
my $swish = SWISH::API->new($INDEX); |
366 |
die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error; |
$swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error; |
367 |
|
|
368 |
# execute query and get number of results from SWISH-E |
# execute query and get number of results from SWISH-E |
369 |
my $search = $swish->New_Search_Object; |
my $search = $swish->New_Search_Object; |
371 |
$search->SetSort($sort); |
$search->SetSort($sort); |
372 |
|
|
373 |
my $results = $search->Execute($sw_q); |
my $results = $search->Execute($sw_q); |
374 |
die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error; |
$swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error; |
375 |
|
|
376 |
my $hits = $results->Hits; |
my $hits = $results->Hits; |
377 |
|
|
378 |
$tmpl->param('hits',$hits); |
$tmpl->param('hits',$hits); |
379 |
$tmpl->param('search',$sw_q); |
my $search_msg = $sw_q; |
380 |
|
$search_msg .= '<em>'.$swish_msg.'</em>' if ($swish_msg); |
381 |
|
$tmpl->param('search', $search_msg); |
382 |
|
|
383 |
$tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0); |
$tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0); |
384 |
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); |
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); |
442 |
my $field = $q->param("f$i"); |
my $field = $q->param("f$i"); |
443 |
my $limit = $q->param("v$i"); |
my $limit = $q->param("v$i"); |
444 |
|
|
445 |
|
my $filter = $q->param("filter"); |
446 |
|
|
447 |
my $html; |
my $html; |
448 |
|
|
449 |
my $index = new index_DBI( |
my $index = new index_DBI( |
453 |
$cfg_global->val('global', 'dbi_passwd') || '' |
$cfg_global->val('global', 'dbi_passwd') || '' |
454 |
); |
); |
455 |
|
|
456 |
my $total = $index->count($field,$limit); |
my $total = $index->count($field,$limit,$filter); |
457 |
|
|
458 |
if (! $total) { |
if (! defined($total)) { |
459 |
my $tmpl = $self->load_tmpl(url_ex($q,'no_index.html')); |
my $tmpl = $self->load_tmpl(url_ex($q,'no_index.html')); |
460 |
$tmpl->param('field',$field); |
$tmpl->param('field',$field); |
461 |
$html = $tmpl->output; |
$html = $tmpl->output; |
488 |
make_pager($q, $tmpl, $pager); |
make_pager($q, $tmpl, $pager); |
489 |
make_pager_vars($q, $tmpl, @persist_vars); |
make_pager_vars($q, $tmpl, @persist_vars); |
490 |
|
|
491 |
my @pager_data_list = $index->fetch($field,$limit, $pager->first - 1, $pager->entries_on_this_page); |
my @pager_data_list = $index->fetch($field,$limit, $pager->first - 1, $pager->entries_on_this_page, $filter); |
492 |
$tmpl->param('PAGER_DATA_LIST', \@pager_data_list); |
$tmpl->param('PAGER_DATA_LIST', \@pager_data_list); |
493 |
|
|
494 |
return in_template($q,$tmpl->output); |
return in_template($q,$tmpl->output); |