/[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 16 by dpavlin, Wed Jan 4 22:43:24 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    
 my $options = {  
         # check N-gram keys skipping by three  
         SURE => 1 << 0,  
         # check N-gram keys skipping by two  
         USUAL => 1 << 1,  
         # without TF-IDF tuning  
         FAST => 1 << 2,  
         # with the simplified phrase  
         AGITO => 1 << 3,  
         # check every N-gram key  
         NOIDF => 1 << 4,  
         # check N-gram keys skipping by one  
         SIMPLE => 1 << 10,  
 };  
   
314  =head1 Search::Estraier::Condition  =head1 Search::Estraier::Condition
315    
316  =head2 new  =head2 new
# Line 340  sub new { Line 327  sub new {
327          $self ? return $self : return undef;          $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 = {
384            # check N-gram keys skipping by three
385            SURE => 1 << 0,
386            # check N-gram keys skipping by two
387            USUAL => 1 << 1,
388            # without TF-IDF tuning
389            FAST => 1 << 2,
390            # with the simplified phrase
391            AGITO => 1 << 3,
392            # check every N-gram key
393            NOIDF => 1 << 4,
394            # check N-gram keys skipping by one
395            SIMPLE => 1 << 10,
396    };
397    
398    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  package Search::Estraier::Master;  package Search::Estraier::Master;
406    

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

  ViewVC Help
Powered by ViewVC 1.1.26