Xapian/Results.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Xapian/Result.pm ↑ Summary Xapian/Indexer.pm »
1 package SWISH::Prog::Xapian::Results;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw( SWISH::Prog::Results );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 0 ▶use SWISH::Prog::Xapian::Result;
Subroutine BEGIN: called CC=1 SCAR=2.6
6  
7 __PACKAGE__->mk_ro_accessors(qw( mset prop_id_map query facets ));
8  
9 our $VERSION = '0.09';
10  
11 =head1 NAME
12  
13 SWISH::Prog::Xapian::Results - search results for Swish3 Xapian backend
14  
15 =head1 SYNOPSIS
16  
17 # see SWISH::Prog::Results
18
19 =cut
20  
21 =head1 METHODS
22  
23 Only new and overridden methods are documented here. See
24 the L<SWISH::Prog::Results> documentation.
25  
26 =cut
27  
28 =head2 mset
29  
30 Get the internal Search::Xapian::MSet object. This is a read-only
31 accessor method.
32  
33 =head2 prop_id_map
34  
35 Get the read-only internal map for PropertyNames to id values.
36  
37 =head2 query
38  
39 Get the Search::Query object representing the original query string.
40  
41 =head2 facets
42  
43 If C<get_facets> was defined in Searcher->search, returns hash ref
44 of facet values and counts.
45  
46 =head2 next
47  
48 Returns the next SWISH::Prog::Xapian::Result from the Results iterator.
49  
50 =cut
51  
52 sub next {
53 my $self = shift;
54 my $i = $self->{_i}++;
55 return if $i >= $self->hits;
56 my $mit = $self->{mset}->get_msetiterator($i);
57 return SWISH::Prog::Xapian::Result->new(
58 prop_id_map => $self->{prop_id_map},
59 doc => $mit->get_document(),
60 score => $mit->get_percent() * 10, # scale to 1000
61 );
62 }
63  
64 1;
65  
66 __END__
« Xapian/Result.pm ↑ Summary Xapian/Indexer.pm »