/[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 20 by dpavlin, Thu Jan 5 13:55:06 2006 UTC revision 23 by dpavlin, Thu Jan 5 14:30:42 2006 UTC
# Line 487  our @ISA = qw/Search::Estraier/; Line 487  our @ISA = qw/Search::Estraier/;
487    
488  =head2 new  =head2 new
489    
490    my $doc = new Search::HyperEstraier::ResultDocument(    my $rdoc = new Search::HyperEstraier::ResultDocument(
491          uri => 'http://localhost/document/uri/42',          uri => 'http://localhost/document/uri/42',
492          attrs => {          attrs => {
493                  foo => 1,                  foo => 1,
# Line 511  sub new { Line 511  sub new {
511          $self ? return $self : return undef;          $self ? return $self : return undef;
512  }  }
513    
514    =head2 uri
515    
516    Return URI of result document
517    
518      print $rdoc->uri;
519    
520    =cut
521    
522    sub uri {
523            my $self = shift;
524            return $self->{uri};
525    }
526    
527    
528    =head2 attr_names
529    
530    Returns array with attribute names from result document object.
531    
532      my @attrs = $rdoc->attr_names;
533    
534    =cut
535    
536    sub attr_names {
537            my $self = shift;
538            croak "attr_names return array, not scalar" if (! wantarray);
539            return sort keys %{ $self->{attrs} };
540    }
541    
542    =head2 attr
543    
544    Returns value of an attribute.
545    
546      my $value = $rdoc->attr( 'attribute' );
547    
548    =cut
549    
550    sub attr {
551            my $self = shift;
552            my $name = shift || return;
553            return $self->{attrs}->{ $name };
554    }
555    
556    =head2 snippet
557    
558    Return snippet from result document
559    
560      print $rdoc->snippet;
561    
562    =cut
563    
564    sub snippet {
565            my $self = shift;
566            return $self->{snippet};
567    }
568    
569    =head2 keywords
570    
571    Return keywords from result document
572    
573      print $rdoc->keywords;
574    
575    =cut
576    
577    sub keywords {
578            my $self = shift;
579            return $self->{keywords};
580    }
581    
582    
583  package Search::Estraier::Master;  package Search::Estraier::Master;

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

  ViewVC Help
Powered by ViewVC 1.1.26