Dezi-App

 view release on metacpan or  search on metacpan

lib/Dezi/Results.pm  view on Meta::CPAN

package Dezi::Results;
use Moose;
use MooseX::StrictConstructor;
with 'Dezi::Role';
use Carp;
use namespace::autoclean;

our $VERSION = '0.016';

has 'hits' => ( is => 'ro', isa => 'Int', required => 1 );
has 'query' => ( is => 'ro', isa => 'Search::Query::Dialect', required => 1 );
has 'payload'      => ( is => 'ro', isa => 'Object',  required => 1 );
has 'property_map' => ( is => 'ro', isa => 'HashRef', required => 1 );

=head1 NAME

Dezi::Results - base results class

=head1 SYNOPSIS

 my $searcher = Dezi::Searcher->new(
                    invindex        => 'path/to/index',
                    query_class     => 'Dezi::Query',
                    query_parser    => $swish_prog_queryparser,
                );

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

=head1 DESCRIPTION

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

=head1 METHODS

=head2 query

Should return the search query as it was evaluated by the Searcher.
Will be a Search::Query::Dialect object.

=head2 hits

Returns the number of matching documents for the query.

=head2 payload

The internal object holding the backend results.

=head2 property_map

Set by the parent Searcher, a hashref of property aliases to real names.

=head2 next

Return the next Result.

=cut

sub next {
    confess "$_[0] must implement next()";
}

__PACKAGE__->meta->make_immutable;

1;

__END__

=head1 AUTHOR



( run in 1.510 second using v1.01-cache-2.11-cpan-97f6503c9c8 )