247 |
my $full = $q->param('full'); |
my $full = $q->param('full'); |
248 |
|
|
249 |
my @persist_vars = ( 'rm', 'persist_search' ); |
my @persist_vars = ( 'rm', 'persist_search' ); |
250 |
my @url_params = ( 'rm=results', 'show_full=1', 'last_PAGER_offset='.($q->param('PAGER_offset') || 0) ); |
my $url_params = { |
251 |
|
'rm' => 'results', |
252 |
|
'show_full' => 1, |
253 |
|
'last_PAGER_offset' => ($q->param('PAGER_offset') || 0), |
254 |
|
}; |
255 |
|
|
256 |
my @persist_search_vars; |
my @persist_search_vars; |
257 |
my @url_params_persist; |
my $url_params_persist = {}; |
258 |
if ($q->param("persist_search")) { |
if ($q->param("persist_search")) { |
259 |
@persist_search_vars = split(/\s*,\s*/, $q->param("persist_search")); |
@persist_search_vars = split(/\s*,\s*/, $q->param("persist_search")); |
260 |
push @url_params_persist, "persist_search=".$q->url_param("persist_search"); |
$url_params_persist->{'persist_search'} = $q->url_param("persist_search"); |
261 |
push @url_params,"persist_search=".$q->url_param("persist_search"); |
$url_params->{'persist_search'} = $q->url_param("persist_search"); |
262 |
} |
} |
263 |
|
|
264 |
# support parametars "f" and "v" for start |
# support parametars "f" and "v" for start |
279 |
|
|
280 |
# create url parametars (and persistent ones) |
# create url parametars (and persistent ones) |
281 |
|
|
282 |
push @url_params,"f$i=".$q->url_param("f$i"); |
$url_params->{"f$i"} = $q->url_param("f$i"); |
283 |
push @url_params_persist,"f$i=".$q->url_param("f$i") if ($persist); |
$url_params_persist->{"f$i"} = $q->url_param("f$i") if ($persist); |
284 |
|
|
285 |
foreach my $v ($q->url_param("v$i")) { |
foreach my $v ($q->url_param("v$i")) { |
286 |
# escape quotes so that phrase search work |
# escape quotes so that phrase search work |
287 |
$v =~ s/"/%22/g; |
$v =~ s/"/%22/g; |
288 |
push @url_params,"v$i=$v"; |
$url_params->{"v$i"} = $v; |
289 |
push @url_params_persist,"v$i=$v" if ($persist); |
$url_params_persist->{"v$i"} = $v if ($persist); |
290 |
} |
} |
291 |
|
|
292 |
if ($q->param("e$i")) { |
if ($q->param("e$i")) { |
293 |
push @url_params,"e$i=".$q->url_param("e$i"); |
$url_params->{"e$i"} = $q->url_param("e$i"); |
294 |
# push @url_params_persist,"e$i=".$q->url_param("e$i"); |
# $url_params_persist->{"e$i"} = $q->url_param("e$i"); |
295 |
} |
} |
296 |
|
|
297 |
my $wc="*"; # swish wildcard |
my $wc="*"; # swish wildcard |
393 |
if ($filter) { |
if ($filter) { |
394 |
$sw_q .= " and (swishdocpath=\"$filter\")" unless (@path_arr); |
$sw_q .= " and (swishdocpath=\"$filter\")" unless (@path_arr); |
395 |
push @persist_vars, "filter"; |
push @persist_vars, "filter"; |
396 |
push @url_params, "filter=$filter"; |
$url_params->{'filter'} = $filter; |
397 |
push @url_params_persist, "filter=$filter"; |
$url_params_persist->{'filter'} = $filter; |
398 |
} |
} |
399 |
|
|
400 |
my $swish_msg = ' '; |
my $swish_msg = ' '; |
422 |
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); |
$tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); |
423 |
|
|
424 |
# URL parametars for search results |
# URL parametars for search results |
425 |
$tmpl->param('url_params',"?".join("&",@url_params)); |
sub cook_url_params { |
426 |
$tmpl->param('url_params_paths',"?".join("&",@url_params).'&'.join("&",map { my $t = $_; $t =~ s/\#/%23/g; "path=$t"; } @path_arr)); |
my $hash = shift || return; |
427 |
|
return join("&", map { $_."=".$hash->{$_} } keys %{$hash}); |
428 |
|
} |
429 |
|
|
430 |
|
$tmpl->param('url_params',"?".cook_url_params($url_params)); |
431 |
|
$tmpl->param('url_params_paths',"?".cook_url_params($url_params).'&'.join("&",map { my $t = $_; $t =~ s/\#/%23/g; "path=$t"; } @path_arr)); |
432 |
|
|
433 |
|
|
434 |
|
|
465 |
rank => $result->Property('swishrank') |
rank => $result->Property('swishrank') |
466 |
}; |
}; |
467 |
|
|
468 |
$r->{html} = back2html($from_utf8->convert($result->Property('html')), join("&",@url_params_persist)) if ($q->param('show_full')); |
#$r->{html} = back2html($from_utf8->convert($result->Property('html')), cook_url_params($url_params_persist)) if ($q->param('show_full')); |
469 |
|
$r->{html} = back2html($from_utf8->convert($result->Property('html')), $filter ? 'filter='.$filter : '') if ($q->param('show_full')); |
470 |
|
|
471 |
push @pager_data_list, $r; |
push @pager_data_list, $r; |
472 |
} |
} |