Plucene/Index/Term.pm

filter: Statementstmt 90.4% 19 / 21 Branchbran 66.6% 4 / 6 Conditioncond 58.3% 7 / 12 MC/DCmcdc 25.0% 2 / 8 Subroutinesub 81.8% 9 / 11 Podpod 100% 6 / 6 totaltotal 73.4% 47 / 64 CC 8 SCAR 9.9
CC
8
Cov
77%
ne
6.0
ge
6.0
lt
2.1
CRAP 2.7
« Plucene/Analysis/StopFilter.pm ↑ Summary Plucene/Search/PhraseScorer.pm »
1 package Plucene::Index::Term;
2  
3 =head1 NAME
4  
5 Plucene::Index::Term - a word from text
6  
7 =head1 SYNOPSIS
8  
9 my $term = Plucene::Index::Term->new({
10 field => $field_name,
11 text => $text,
12 });
13  
14 # with two Plucene::Index::Term objects you can do:
15
16 if ($term1->eq($term2)) { ... }
17  
18 # etc
19
20 =head1 DESCRIPTION
21  
22 A Term represents a word from text, and is the unit of search. It is
23 composed of two elements, the text of the word, as a string, and the
24 name of the field that the text occured in, as a string.
25  
26 Note that terms may represent more than words from text fields, but
27 also things like dates, email addresses, urls, etc.
28  
29 =head1 METHODS
30  
31 =cut
32  
33 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 19 ▶no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 19 ▶use base 'Class::Accessor::Fast';
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 19 __PACKAGE__->mk_accessors(qw(field text));
40  
41 =head2 eq / ne / lt / gt / ge / le
42  
43 Exactly what you would think they are.
44  
45 =cut
46  
47 1459 ▶sub _cmp {
Subroutine _cmp: called CC=2 SCAR=6.9
48 1459 ▶ ($_[0]->{field} cmp $_[1]->{field}) || ($_[0]->{text} cmp $_[1]->{text});
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"field"} cmp $_[1]{"field"} or $_[0]{"text"} cmp $_[1]{"text"} 408 1051 1459
49 }
50  
51 797 ▶sub eq {
Subroutine eq: called CC=2 SCAR=6.9
Pod documented
52 797 ▶ $_[0]->{field} eq $_[1]->{field} && $_[0]->{text} eq $_[1]->{text};
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"field"} eq $_[1]{"field"} and $_[0]{"text"} eq $_[1]{"text"} 761 36 797
53 }
54  
55 0 ▶sub ne {
Subroutine ne: not called CC=2 SCAR=17.9
Pod documented
56 0 ▶ $_[0]->{field} ne $_[1]->{field} || $_[0]->{text} ne $_[1]->{text};
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"field"} ne $_[1]{"field"} or $_[0]{"text"} ne $_[1]{"text"} 0 0 0
57 }
58  
59 46072 ▶sub lt {
Subroutine lt: called CC=2 SCAR=7.2
Pod documented
60 46072 ▶ ($_[0]->{field} cmp $_[1]->{field} || $_[0]->{text} cmp $_[1]->{text}) < 0;
Condition66%2/3
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
l!l&&r!l&&!r
433456390
MC/DC0%0/2
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
$_[0]{'field'} cmp $_[1]{'field'} $_[0]{'text'} cmp $_[1]{'text'}
Truth table66%2/3
A || B
A= $_[0]{'field'} cmp $_[1]{'field'}B= $_[0]{'text'} cmp $_[1]{'text'}
ABresult
1X1
011
000
61 }
62  
63 39452 ▶sub gt {
Subroutine gt: called CC=2 SCAR=6.9
Pod documented
64 39452 ▶ ($_[0]->{field} cmp $_[1]->{field} || $_[0]->{text} cmp $_[1]->{text}) > 0;
Condition100%3/3
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
l!l&&r!l&&!r
91937994539
MC/DC100%2/2
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
$_[0]{'field'} cmp $_[1]{'field'} $_[0]{'text'} cmp $_[1]{'text'}
Truth table100%3/3
A || B
A= $_[0]{'field'} cmp $_[1]{'field'}B= $_[0]{'text'} cmp $_[1]{'text'}
ABresult
1X1
011
000
65 }
66  
67 0 ▶sub ge {
Subroutine ge: not called CC=2 SCAR=17.9
Pod documented
68 0 ▶ ($_[0]->{field} cmp $_[1]->{field} || $_[0]->{text} cmp $_[1]->{text}) >= 0;
Condition0%0/3
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
$_[0]{'field'} cmp $_[1]{'field'} $_[0]{'text'} cmp $_[1]{'text'}
Truth table0%0/3
A || B
A= $_[0]{'field'} cmp $_[1]{'field'}B= $_[0]{'text'} cmp $_[1]{'text'}
ABresult
1X1
011
000
69 }
70  
71 3 ▶sub le {
Subroutine le: called CC=2 SCAR=7.2
Pod documented
72 3 ▶ ($_[0]->{field} cmp $_[1]->{field} || $_[0]->{text} cmp $_[1]->{text}) <= 0;
Condition66%2/3
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
l!l&&r!l&&!r
120
MC/DC0%0/2
$_[0]{'field'} cmp $_[1]{'field'} || $_[0]{'text'} cmp $_[1]{'text'}
$_[0]{'field'} cmp $_[1]{'field'} $_[0]{'text'} cmp $_[1]{'text'}
Truth table66%2/3
A || B
A= $_[0]{'field'} cmp $_[1]{'field'}B= $_[0]{'text'} cmp $_[1]{'text'}
ABresult
1X1
011
000
73 }
74  
75 19 1;
« Plucene/Analysis/StopFilter.pm ↑ Summary Plucene/Search/PhraseScorer.pm »