File Coverage

blib/lib/Dezi/Results.pm
Criterion Covered Total %
statement 12 13 92.3
branch n/a
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 19 89.4


line stmt bran cond sub pod time code
1             package Dezi::Results;
2 2     2   1674 use Moose;
  2         6  
  2         14  
3 2     2   12956 use MooseX::StrictConstructor;
  2         4  
  2         17  
4             with 'Dezi::Role';
5 2     2   6046 use Carp;
  2         4  
  2         158  
6 2     2   11 use namespace::autoclean;
  2         3  
  2         20  
7              
8             our $VERSION = '0.014';
9              
10             has 'hits' => ( is => 'ro', isa => 'Int', required => 1 );
11             has 'query' => ( is => 'ro', isa => 'Search::Query::Dialect', required => 1 );
12             has 'payload' => ( is => 'ro', isa => 'Object', required => 1 );
13             has 'property_map' => ( is => 'ro', isa => 'HashRef', required => 1 );
14              
15             =head1 NAME
16              
17             Dezi::Results - base results class
18              
19             =head1 SYNOPSIS
20              
21             my $searcher = Dezi::Searcher->new(
22             invindex => 'path/to/index',
23             query_class => 'Dezi::Query',
24             query_parser => $swish_prog_queryparser,
25             );
26            
27             my $results = $searcher->search( 'foo bar' );
28             while (my $result = $results->next) {
29             printf("%4d %s\n", $result->score, $result->uri);
30             }
31              
32             =head1 DESCRIPTION
33              
34             Dezi::Results is a base results class. It defines
35             the APIs that all Dezi storage backends adhere to in
36             returning results from a Dezi::InvIndex.
37              
38             =head1 METHODS
39              
40             =head2 query
41              
42             Should return the search query as it was evaluated by the Searcher.
43             Will be a Search::Query::Dialect object.
44              
45             =head2 hits
46              
47             Returns the number of matching documents for the query.
48              
49             =head2 payload
50              
51             The internal object holding the backend results.
52              
53             =head2 property_map
54              
55             Set by the parent Searcher, a hashref of property aliases to real names.
56              
57             =head2 next
58              
59             Return the next Result.
60              
61             =cut
62              
63             sub next {
64 0     0 1   confess "$_[0] must implement next()";
65             }
66              
67             __PACKAGE__->meta->make_immutable;
68              
69             1;
70              
71             __END__
72              
73             =head1 AUTHOR
74              
75             Peter Karman, E<lt>karpet@dezi.orgE<gt>
76              
77             =head1 BUGS
78              
79             Please report any bugs or feature requests to C<bug-dezi-app at rt.cpan.org>, or through
80             the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-App>.
81             I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
82              
83             =head1 SUPPORT
84              
85             You can find documentation for this module with the perldoc command.
86              
87             perldoc Dezi::Results
88              
89             You can also look for information at:
90              
91             =over 4
92              
93             =item * Website
94              
95             L<http://dezi.org/>
96              
97             =item * IRC
98              
99             #dezisearch at freenode
100              
101             =item * Mailing list
102              
103             L<https://groups.google.com/forum/#!forum/dezi-search>
104              
105             =item * RT: CPAN's request tracker
106              
107             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dezi-App>
108              
109             =item * AnnoCPAN: Annotated CPAN documentation
110              
111             L<http://annocpan.org/dist/Dezi-App>
112              
113             =item * CPAN Ratings
114              
115             L<http://cpanratings.perl.org/d/Dezi-App>
116              
117             =item * Search CPAN
118              
119             L<https://metacpan.org/dist/Dezi-App/>
120              
121             =back
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             Copyright 2014 by Peter Karman
126              
127             This library is free software; you can redistribute it and/or modify
128             it under the terms of the GPL v2 or later.
129              
130             =head1 SEE ALSO
131              
132             L<http://dezi.org/>, L<http://swish-e.org/>, L<http://lucy.apache.org/>
133