blib/lib/KinoSearch1/Search/Hit.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 2 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 88.1% 37 / 42 CC 4 SCAR 6.0
CC
4
Cov
90%
get_field_values
3.1
get_doc
2.0
BEGIN
1.0
CRAP 1.8
« blib/lib/KinoSearch1/Search/TermQuery.pm ↑ Summary blib/lib/KinoSearch1/Store/Lock.pm »
1 package KinoSearch1::Search::Hit;
2 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use KinoSearch1::Util::ToolSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 20 ▶use base qw( KinoSearch1::Util::Class );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 20 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 20 __PACKAGE__->init_instance_vars(
9 # constructor params / members
10 id => undef,
11 score => undef,
12 searcher => undef,
13 # members
14 doc => undef,
15 hashref => undef,
16 );
17 20 __PACKAGE__->ready_get(qw( id score ));
18 }
19  
20 47 ▶sub get_doc {
Subroutine get_doc: called CC=2 SCAR=7.0
Pod documented
21 47 my $self = shift;
22 47 ▶ $self->{doc} ||= $self->{searcher}->fetch_doc( $self->{id} );
Condition66%2/3
$self->{"doc"} ||= $self->{"searcher"}->fetch_doc($self->{"id"})
l!l&&r!l&&!r
1460
MC/DC0%0/2
$self->{"doc"} ||= $self->{"searcher"}->fetch_doc($self->{"id"})
$self->{"doc"} $self->{"searcher"}->fetch_doc($self->{"id"})
Truth table66%2/3
A ||= B
A= $self->{"doc"}B= $self->{"searcher"}->fetch_doc($self->{"id"})
ABresult
1X1
011
000
23 47 return $self->{doc};
24 }
25  
26 43 ▶sub get_field_values {
Subroutine get_field_values: called CC=3 SCAR=11.2
Pod documented
27 43 my $self = shift;
28 43 ▶ if ( !defined $self->{hashref} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"hashref"}) 43 0 43
29 43 ▶ if ( !defined $self->{doc} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"doc"}) 43 0 43
30 43 $self->get_doc;
31 }
32 43 $self->{hashref} = $self->{doc}->to_hashref;
33 }
34 43 return $self->{hashref};
35 }
36  
37 20 1;
38  
39 __END__
« blib/lib/KinoSearch1/Search/TermQuery.pm ↑ Summary blib/lib/KinoSearch1/Store/Lock.pm »