/[mws]/trunk/MWS_swish.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/MWS_swish.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by dpavlin, Fri May 7 23:35:39 2004 UTC revision 21 by dpavlin, Sat May 8 00:54:16 2004 UTC
# Line 36  sub open_index { Line 36  sub open_index {
36  sub search_index {  sub search_index {
37          my $self = shift;          my $self = shift;
38    
39          my $s = shift || croak "search_index needs query";          croak "search_index needs query" if (! @_);
40    
41          my $index = $self->open_index;          my $index = $self->open_index;
42    
43          if ($s =~ /:/) {          my $sw;
44                  my ($fld,$val) = split(/:/,$s,2);  
45                  $s = "$fld=($val)";          foreach my $s (@_) {
46    
47                    if ($s =~ /^\s*(\w+):(.+)\s*$/) {
48                            $sw .= "$1=($2)";
49                    } else {
50                            # and/or/not operators
51                            $sw .= " $s ";
52                    }
53          }          }
54    
55          print STDERR "swish search: $s\n";          print STDERR "swish search: $sw\n";
56    
57          # convert to UTF-8          # convert to UTF-8
58          $s = $iso2utf->convert($s) || $s;          $sw = $iso2utf->convert($sw) || $sw;
59          my $results = $index->Query($s);          my $results = $index->Query($sw);
60    
61          # store total number of hits          # store total number of hits
62          $self->{'total_hits'} = $results->Hits;          $self->{'total_hits'} = $results->Hits;

Legend:
Removed from v.20  
changed lines
  Added in v.21

  ViewVC Help
Powered by ViewVC 1.1.26