fixed transfer of variables with multiple values in headline
[webpac] / WebPac.pm
index a9aef81..209c926 100644 (file)
--- a/WebPac.pm
+++ b/WebPac.pm
@@ -95,7 +95,8 @@ sub show_results_list {
        my @persist_vars = ( 'rm' ); 
        my @url_params = ( 'rm=results', 'show_full=1', 'last_PAGER_offset='.$q->param('PAGER_offset') || 0 );
 
-       for(my $i = 1; $i <=30; $i++) {
+       # support parametars "f" and "v" for start
+       for(my $i = ""; $i <=30; $i++) {
 
                return show_index($self, $i) if ($q->param("f".$i."_index"));
 
@@ -106,7 +107,12 @@ sub show_results_list {
                push @persist_vars, "v$i";
 
                push @url_params,"f$i=".$q->url_param("f$i");
-               push @url_params,"v$i=".$q->url_param("v$i");
+               foreach my $v ($q->url_param("v$i")) {
+                       push @url_params,"v$i=$v";
+               }
+
+               my $wc="*";     # swish wildcard
+               $wc="" if ($i eq "");   # don't apply wildcard on field 0
 
                # re-write query from +/- to and/and not
                my @param_vals = $q->param("v$i");
@@ -125,14 +131,14 @@ sub show_results_list {
                                if (m/^([+-])(\S+)/) {
                                        $s.= ($s) ? "and " : "";
                                        $s.="not " if ($1 eq "-");
-                                       $s.="$2* ";
+                                       $s.="$2$wc ";
                                } elsif (m/^\s*(and|or|not)\s*$/i) {
                                        $s.="$_ ";
                                # don't add * to words with less than x chars
                                } elsif (length($_) <= $MIN_WILDCARD) {
                                        $s.="$_ ";
                                } else {
-                                       $s.="$_* ";
+                                       $s.="$_$wc ";
                                }
                        }
                        $s =~ s/\*+/*/g;
@@ -180,6 +186,9 @@ sub show_results_list {
                $sw_q .= join("\" or swishdocpath=\"",@path_arr);
                $sw_q .= "\")";
                $tmpl->param('full',1); # show full records
+       } elsif ($q->param('show_full')) {
+               # just show full path, no path defined
+               $tmpl->param('full',1);
        } else {
                $tmpl->param('full',0);
        }