File Coverage

blib/lib/Plucene/Search/PhraseScorer/Exact.pm
Criterion Covered Total %
statement 25 25 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Plucene::Search::PhraseScorer::Exact;
2              
3             =head1 NAME
4              
5             Plucene::Search::PhraseScorer::Exact - exact phrase scorer
6              
7             =head1 SYNOPSIS
8              
9             # isa Plucene::Search::PhraseScorer
10              
11             =head1 DESCRIPTION
12              
13             This is the eact phrase scorer
14              
15             =cut
16              
17 4     4   22 use strict;
  4         9  
  4         126  
18 4     4   19 use warnings;
  4         7  
  4         114  
19              
20 4     4   70 use base 'Plucene::Search::PhraseScorer';
  4         10  
  4         2006  
21              
22             sub _phrase_freq {
23 51     51   324 my $self = shift;
24 51         152 my $pp = $self->first;
25 51         316 while ($pp) {
26 109         656 $pp->first_position;
27 109         968 push @{ $self->{pq} }, $pp;
  109         517  
28 109         2505 $pp = $pp->next_in_list;
29             }
30              
31 51         425 $self->_pq_to_list;
32              
33 51         410 my $freq = 0;
34 51         67 do {
35 68         356 while ($self->first->position < $self->last->position) {
36 167         2847 do {
37 305 100       4493 return $freq unless $self->first->next_position;
38             } while $self->first->position < $self->last->position;
39 127         3260 $self->_first_to_last;
40             }
41 28         701 $freq++;
42             } while $self->last->next_position;
43 11         40 return $freq;
44             }
45              
46             1;