support for "f" and "v" fields without number on which wildcards don't apply
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 16 Nov 2003 22:39:06 +0000 (22:39 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 16 Nov 2003 22:39:06 +0000 (22:39 +0000)
git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@150 13eb9ef6-21d5-0310-b721-a9d68796d827

WebPac.pm

index 43e9191..9511406 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"));
 
@@ -108,6 +109,9 @@ sub show_results_list {
                push @url_params,"f$i=".$q->url_param("f$i");
                push @url_params,"v$i=".$q->url_param("v$i");
 
+               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");
                my @swish_q;
@@ -125,14 +129,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;