/[webpac]/trunk/WebPac.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/WebPac.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 642 by dpavlin, Sun Jan 23 14:31:02 2005 UTC revision 657 by dpavlin, Mon Jan 31 12:08:35 2005 UTC
# Line 148  sub make_pager($$$) { Line 148  sub make_pager($$$) {
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 {
# Line 359  sub show_results_list { Line 359  sub show_results_list {
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;
# Line 369  sub show_results_list { Line 371  sub show_results_list {
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);
# Line 438  sub show_index { Line 442  sub show_index {
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(
# Line 447  sub show_index { Line 453  sub show_index {
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;
# Line 482  sub show_index { Line 488  sub show_index {
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);

Legend:
Removed from v.642  
changed lines
  Added in v.657

  ViewVC Help
Powered by ViewVC 1.1.26