SWISH::Prog::Result - base result class


SWISH-Prog documentation Contained in the SWISH-Prog distribution.

Index


Code Index:

NAME

Top

SWISH::Prog::Result - base result class

SYNOPSIS

Top

 my $results = $searcher->search( 'foo bar' );
 while (my $result = $results->next) {
     printf("%4d %s\n", $result->score, $result->uri);
 }

DESCRIPTION

Top

SWISH::Prog::Results is a base results class. It defines the APIs that all SWISH::Prog storage backends adhere to in returning results from a SWISH::Prog::InvIndex.

METHODS

Top

The following methods are all accessors (getters) only.

doc

Returns a SWISH::Prog::Doc instance.

score

Returns the ranking score for the Result.

uri

mtime

title

summary

swishdocpath

Alias for uri().

swishlastmodified

Alias for mtime().

swishtitle

Alias for title().

swishdescription

Alias for summary().

get_property( property )

Returns the stored value for property for this Result.

The default behavior is to simply call a method called property on the internal doc() object. Subclasses should implement per-engine behavior.

AUTHOR

Top

Peter Karman, <perl@peknet.com>

BUGS

Top

Please report any bugs or feature requests to bug-swish-prog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SWISH-Prog. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc SWISH::Prog




You can also look for information at:

* Mailing list

http://lists.swish-e.org/listinfo/users

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=SWISH-Prog

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/SWISH-Prog

* CPAN Ratings

http://cpanratings.perl.org/d/SWISH-Prog

* Search CPAN

http://search.cpan.org/dist/SWISH-Prog/

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

http://swish-e.org/


SWISH-Prog documentation Contained in the SWISH-Prog distribution.
package SWISH::Prog::Result;
use strict;
use warnings;
use base qw( SWISH::Prog::Class );
use Carp;

our $VERSION = '0.51';

__PACKAGE__->mk_accessors(qw( doc score ));

sub uri     { croak "must implement uri" }
sub mtime   { croak "must implement mtime" }
sub title   { croak "must implement title" }
sub summary { croak "must implement summary" }

# version 2 names for the faithful
sub swishdocpath      { shift->uri }
sub swishlastmodified { shift->mtime }
sub swishtitle        { shift->title }
sub swishdescription  { shift->summary }

sub get_property {
    my $self = shift;
    my $propname = shift or croak "propname required";
    return $self->doc->property($propname);
}

1;

__END__