--- trunk/WebPac.pm 2005/01/23 15:18:03 643
+++ trunk/WebPac.pm 2005/02/15 21:48:16 659
@@ -148,7 +148,7 @@
foreach my $p (@{$pager->pages_in_set()}) {
- next if ($p < 0);
+ next if ($p <= 0);
if($p == $pager->current_page()) {
$pager_jump .= "$p ";
} else {
@@ -344,6 +344,10 @@
$sort = 'headline';
push @persist_vars, "sort";
}
+ if ($q->param("sortby")) {
+ $sort = $q->param("sortby");
+ push @persist_vars, "sort";
+ }
# construct swish query
my $sw_q = join(" and ",@s_arr);
@@ -359,22 +363,27 @@
$tmpl->param('full',0);
}
+ my $swish_msg = ' ';
+
# create new swish instance
my $swish = SWISH::API->new($INDEX);
- die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error;
+ $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
# execute query and get number of results from SWISH-E
my $search = $swish->New_Search_Object;
$search->SetSort($sort);
+print "sort: $sort\n";
my $results = $search->Execute($sw_q);
- die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error;
+ $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
my $hits = $results->Hits;
$tmpl->param('hits',$hits);
- $tmpl->param('search',$sw_q);
+ my $search_msg = $sw_q;
+ $search_msg .= ''.$swish_msg.'' if ($swish_msg);
+ $tmpl->param('search', $search_msg);
$tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0);
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0);