/[Search-Estraier]/trunk/lib/Search/Estraier.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/lib/Search/Estraier.pm

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

revision 173 by dpavlin, Sun Aug 6 18:15:11 2006 UTC revision 191 by dpavlin, Sun Nov 5 16:26:57 2006 UTC
# Line 4  use 5.008; Line 4  use 5.008;
4  use strict;  use strict;
5  use warnings;  use warnings;
6    
7  our $VERSION = '0.07_3';  our $VERSION = '0.08';
8    
9  =head1 NAME  =head1 NAME
10    
# Line 188  sub new { Line 188  sub new {
188                                          warn "can't decode $line\n";                                          warn "can't decode $line\n";
189                                  }                                  }
190                                  next;                                  next;
191                            } elsif ($line =~ m/^%SCORE\t(.+)$/) {
192                                $self->{score} = $1;
193                                next;
194                          } elsif ($line =~ m/^%/) {                          } elsif ($line =~ m/^%/) {
195                                  # What is this? comment?                                  # What is this? comment?
196                                  #warn "$line\n";                                  #warn "$line\n";
# Line 290  sub add_vectors { Line 293  sub add_vectors {
293          $self->{kwords} = {@_};          $self->{kwords} = {@_};
294  }  }
295    
296    =head2 set_score
297    
298    Set the substitute score
299    
300      $doc->set_score(12345);
301    
302    =cut
303    
304    sub set_score {
305        my $self = shift;
306        my $score = shift;
307        return unless (defined($score));
308        $self->{score} = $score;
309    }
310    
311    =head2 score
312    
313    Get the substitute score
314    
315    =cut
316    
317    sub score {
318        my $self = shift;
319        return -1 unless (defined($self->{score}));
320        return $self->{score};
321    }
322    
323  =head2 id  =head2 id
324    
# Line 391  sub dump_draft { Line 420  sub dump_draft {
420                  $draft .= "\n";                  $draft .= "\n";
421          }          }
422    
423            if (defined($self->{score}) && $self->{score} >= 0) {
424                $draft .= "%SCORE\t" . $self->{score} . "\n";
425            }
426    
427          $draft .= "\n";          $draft .= "\n";
428    
429          $draft .= join("\n", @{ $self->{dtexts} }) . "\n" if ($self->{dtexts});          $draft .= join("\n", @{ $self->{dtexts} }) . "\n" if ($self->{dtexts});
# Line 677  sub skip { Line 710  sub skip {
710          return $self->{skip};          return $self->{skip};
711  }  }
712    
713    
714    =head2 set_distinct
715    
716      $cond->set_distinct('@author');
717    
718    =cut
719    
720    sub set_distinct {
721            my $self = shift;
722            $self->{distinct} = shift;
723    }
724    
725    =head2 distinct
726    
727    Return distinct attribute
728    
729      print $cond->distinct;
730    
731    =cut
732    
733    sub distinct {
734            my $self = shift;
735            return $self->{distinct};
736    }
737    
738  =head2 set_mask  =head2 set_mask
739    
740  Select just some links when searching and not all.  Filter out some links when searching.
741    
742  Argument array of link numbers, starting with 0.  Argument array of link numbers, starting with 0 (current node).
743    
744    $cond->set_mask(qw/0 1 4/);    $cond->set_mask(qw/0 1 4/);
745    
# Line 1580  sub cond_to_query { Line 1638  sub cond_to_query {
1638          push @args, 'awidth=' . $self->{awidth};          push @args, 'awidth=' . $self->{awidth};
1639          push @args, 'skip=' . $cond->{skip} if ($cond->{skip});          push @args, 'skip=' . $cond->{skip} if ($cond->{skip});
1640    
1641            if (my $distinct = $cond->distinct) {
1642                    push @args, 'distinct=' . uri_escape($distinct);
1643            }
1644    
1645          if ($cond->{mask}) {          if ($cond->{mask}) {
1646                  my $mask = 0;                  my $mask = 0;
1647                  map { $mask += ( 2 ** $_ ) } @{ $cond->{mask} };                  map { $mask += ( 2 ** $_ ) } @{ $cond->{mask} };

Legend:
Removed from v.173  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.26