/[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 15 by dpavlin, Wed Jan 4 22:24:57 2006 UTC revision 18 by dpavlin, Wed Jan 4 22:48:29 2006 UTC
# Line 306  sub delete { Line 306  sub delete {
306    
307  package Search::Estraier::Condition;  package Search::Estraier::Condition;
308    
309    use Carp qw/confess croak/;
310    
311  use Search::Estraier;  use Search::Estraier;
312  our @ISA = qw/Search::Estraier/;  our @ISA = qw/Search::Estraier/;
313    
314    =head1 Search::Estraier::Condition
315    
316    =head2 new
317    
318      my $cond = new Search::HyperEstraier::Condition;
319    
320    =cut
321    
322    sub new {
323            my $class = shift;
324            my $self = {};
325            bless($self, $class);
326    
327            $self ? return $self : return undef;
328    }
329    
330    =head2 set_phrase
331    
332      $cond->set_phrase('search phrase');
333    
334    =cut
335    
336    sub set_phrase {
337            my $self = shift;
338            $self->{phrase} = $self->_s( shift );
339    }
340    
341    =head2 add_attr
342    
343      $cond->add_attr('@URI STRINC /~dpavlin/');
344    
345    =cut
346    
347    sub add_attr {
348            my $self = shift;
349            my $attr = shift || return;
350            push @{ $self->{attrs} }, $self->_s( $attr );
351    }
352    
353    =head2 set_order
354    
355      $cond->set_order('@mdate NUMD');
356    
357    =cut
358    
359    sub set_order {
360            my $self = shift;
361            $self->{order} = shift;
362    }
363    
364    =head2 set_max
365    
366      $cond->set_max(42);
367    
368    =cut
369    
370    sub set_max {
371            my $self = shift;
372            my $max = shift;
373            croak "set_max needs number" unless ($max =~ m/^\d+$/);
374            $self->{max} = $max;
375    }
376    
377    =head2 set_options
378    
379      $cond->set_options( SURE => 1 );
380    
381    =cut
382    
383  my $options = {  my $options = {
384          # check N-gram keys skipping by three          # check N-gram keys skipping by three
385          SURE => 1 << 0,          SURE => 1 << 0,
# Line 324  my $options = { Line 395  my $options = {
395          SIMPLE => 1 << 10,          SIMPLE => 1 << 10,
396  };  };
397    
398  =head1 Search::Estraier::Condition  sub set_options {
399            my $self = shift;
400            my $option = shift;
401            confess "unknown option" unless ($options->{$option});
402            $self->{options} ||= $options->{$option};
403    }
404    
405  =head2 new  =head2 phrase
406    
407    my $cond = new Search::HyperEstraier::Condition;  Return search phrase.
408    
409  =cut    print $cond->phrase;
410    
411  sub new {  =cut
         my $class = shift;  
         my $self = {};  
         bless($self, $class);  
412    
413          $self ? return $self : return undef;  sub phrase {
414            my $self = shift;
415            return $self->{phrase};
416  }  }
417    
418    

Legend:
Removed from v.15  
changed lines
  Added in v.18

  ViewVC Help
Powered by ViewVC 1.1.26