344 |
$sort = 'headline'; |
$sort = 'headline'; |
345 |
push @persist_vars, "sort"; |
push @persist_vars, "sort"; |
346 |
} |
} |
347 |
|
if ($q->param("sortby")) { |
348 |
|
$sort = $q->param("sortby"); |
349 |
|
push @persist_vars, "sort"; |
350 |
|
} |
351 |
|
|
352 |
# construct swish query |
# construct swish query |
353 |
my $sw_q = join(" and ",@s_arr); |
my $sw_q = join(" and ",@s_arr); |
363 |
$tmpl->param('full',0); |
$tmpl->param('full',0); |
364 |
} |
} |
365 |
|
|
366 |
|
my $swish_msg = ' '; |
367 |
|
|
368 |
# create new swish instance |
# create new swish instance |
369 |
my $swish = SWISH::API->new($INDEX); |
my $swish = SWISH::API->new($INDEX); |
370 |
die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error; |
$swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error; |
371 |
|
|
372 |
# execute query and get number of results from SWISH-E |
# execute query and get number of results from SWISH-E |
373 |
my $search = $swish->New_Search_Object; |
my $search = $swish->New_Search_Object; |
374 |
|
|
375 |
$search->SetSort($sort); |
$search->SetSort($sort); |
376 |
|
print "sort: $sort\n"; |
377 |
|
|
378 |
my $results = $search->Execute($sw_q); |
my $results = $search->Execute($sw_q); |
379 |
die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error; |
$swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error; |
380 |
|
|
381 |
my $hits = $results->Hits; |
my $hits = $results->Hits; |
382 |
|
|
383 |
$tmpl->param('hits',$hits); |
$tmpl->param('hits',$hits); |
384 |
$tmpl->param('search',$sw_q); |
my $search_msg = $sw_q; |
385 |
|
$search_msg .= '<em>'.$swish_msg.'</em>' if ($swish_msg); |
386 |
|
$tmpl->param('search', $search_msg); |
387 |
|
|
388 |
$tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0); |
$tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0); |
389 |
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); |
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); |