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

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

revision 166 by dpavlin, Sun Aug 6 12:48:02 2006 UTC revision 176 by dpavlin, Sun Aug 6 18:43:58 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.07';
8    
9  =head1 NAME  =head1 NAME
10    
# Line 677  sub skip { Line 677  sub skip {
677          return $self->{skip};          return $self->{skip};
678  }  }
679    
680    =head2 set_mask
681    
682    Filter out some links when searching.
683    
684    Argument array of link numbers, starting with 0 (current node).
685    
686      $cond->set_mask(qw/0 1 4/);
687    
688    =cut
689    
690    sub set_mask {
691            my $self = shift;
692            return unless (@_);
693            $self->{mask} = \@_;
694    }
695    
696    
697  package Search::Estraier::ResultDocument;  package Search::Estraier::ResultDocument;
698    
# Line 1353  sub _fetch_doc { Line 1369  sub _fetch_doc {
1369          $path = '/etch_doc' if ($a->{etch});          $path = '/etch_doc' if ($a->{etch});
1370    
1371          if ($a->{id}) {          if ($a->{id}) {
1372                  croak "id must be numberm not '$a->{id}'" unless ($a->{id} =~ m/^\d+$/);                  croak "id must be number not '$a->{id}'" unless ($a->{id} =~ m/^\d+$/);
1373                  $arg = 'id=' . $a->{id};                  $arg = 'id=' . $a->{id};
1374          } elsif ($a->{uri}) {          } elsif ($a->{uri}) {
1375                  $arg = 'uri=' . uri_escape($a->{uri});                  $arg = 'uri=' . uri_escape($a->{uri});
# Line 1564  sub cond_to_query { Line 1580  sub cond_to_query {
1580          push @args, 'awidth=' . $self->{awidth};          push @args, 'awidth=' . $self->{awidth};
1581          push @args, 'skip=' . $cond->{skip} if ($cond->{skip});          push @args, 'skip=' . $cond->{skip} if ($cond->{skip});
1582    
1583            if ($cond->{mask}) {
1584                    my $mask = 0;
1585                    map { $mask += ( 2 ** $_ ) } @{ $cond->{mask} };
1586    
1587                    push @args, 'mask=' . $mask if ($mask);
1588            }
1589    
1590          return join('&', @args);          return join('&', @args);
1591  }  }
1592    

Legend:
Removed from v.166  
changed lines
  Added in v.176

  ViewVC Help
Powered by ViewVC 1.1.26