--- branches/humanistika/WebPac.pm 2005/03/13 02:03:30 697 +++ branches/humanistika/WebPac.pm 2005/04/30 15:48:40 704 @@ -337,6 +337,7 @@ } } $s =~ s/\*+/*/g; + $s =~ s/[()]//g; # () are used in query language $s = $pre.$s.$post if ($q->param("e$i")); push @swish_q,$s; } @@ -347,8 +348,6 @@ my $tmpl = $self->load_tmpl(url_ex($q,'results.html'), global_vars => 1, die_on_bad_params => 0); - $tmpl->param('url_params',"?".join("&",@url_params)); - sub esc_html { my $html = shift; $html =~ s/param('url_params_paths',"?".join("&",@url_params).'&'.join("&",map { my $t = $_; $t =~ s/\#/%23/g; "path=$t"; } @path_arr)); + # used to filter entries in index and swish + my $filter = $q->param("filter"); # construct swish query my $sw_q = join(" and ",@s_arr); if (@path_arr && $q->param('show_full')) { - $sw_q .= "and (swishdocpath=\""; + $sw_q .= " and (swishdocpath=\""; $sw_q .= join("\" or swishdocpath=\"",@path_arr); $sw_q .= "\")"; $tmpl->param('full',1); # show full records +# } elsif (@path_arr && $#path_arr == 0) { +# # I will assume that it's a filter since there isn't show_full +# $filter = shift @path_arr; } elsif ($q->param('show_full')) { # just show full path, no path defined $tmpl->param('full',1); @@ -383,6 +386,13 @@ $tmpl->param('full',0); } + if ($filter) { + $sw_q .= " and (swishdocpath=\"$filter\")" unless (@path_arr); + push @persist_vars, "filter"; + push @url_params, "filter=$filter"; + push @url_params_persist, "filter=$filter"; + } + my $swish_msg = ' '; # create new swish instance @@ -407,6 +417,12 @@ $tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0); $tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0); + # URL parametars for search results + $tmpl->param('url_params',"?".join("&",@url_params)); + $tmpl->param('url_params_paths',"?".join("&",@url_params).'&'.join("&",map { my $t = $_; $t =~ s/\#/%23/g; "path=$t"; } @path_arr)); + + + # # build pager #