Plucene/Document/Field.pm

filter: Statementstmt 90.9% 20 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 4 / 4 totaltotal 91.1% 31 / 34 CC 1 SCAR 1.2
CC
1
Cov
91%
UnIndexed
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Plucene/Analysis/Standard/StandardAnalyzer.pm ↑ Summary Plucene/Analysis/LetterTokenizer.pm »
1 package Plucene::Document::Field;
2  
3 =head1 NAME
4  
5 Plucene::Document::Field - A field in a Plucene::Document
6  
7 =head1 SYNOPSIS
8  
9 my $field = Plucene::Document::Field->Keyword($name, $string);
10 my $field = Plucene::Document::Field->Text($name, $string);
11  
12 my $field = Plucene::Document::Field->UnIndexded($name, $string);
13 my $field = Plucene::Document::Field->UnStored($name, $string);
14  
15 =head1 DESCRIPTION
16  
17 Each Plucene::Document is made up of Plucene::Document::Field
18 objects. Each of these fields can be stored, indexed or tokenised.
19  
20 =head1 FIELDS
21  
22 =cut
23  
24 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 18 ▶use base qw(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 18 __PACKAGE__->mk_accessors(
29 qw(name string is_stored is_indexed is_tokenized reader));
30  
31 =head2 name
32  
33 Returns the name of the field.
34  
35 =head2 string
36  
37 Returns the value of the field.
38  
39 =head2 is_stored
40  
41 Returns true if the field is or will be stored, or false if it was
42 created with C<UnStored>.
43  
44 =head2 is_indexed
45  
46 Returns true if the field is or will be indexed, or false if it was
47 created with C<UnIndexed>.
48  
49 =head2 is_tokenized
50  
51 Returns true if the field is or will be tokenized, or false if it was
52 created with C<UnIndexed> or C<Keyword>.
53  
54 =cut
55  
56 18 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
57  
58 =head1 METHODS
59  
60 =head2 Keyword
61  
62 my $field = Plucene::Document::Field->Keyword($name, $string);
63  
64 This will make a new Plucene::Document::Field object that is stored
65 and indexed, but not tokenised.
66
67 =cut
68  
69 48 ▶sub Keyword {
Subroutine Keyword: called CC=1 SCAR=0.0
Pod documented
70 48 my ($self, $name, $string) = @_;
71 48 return $self->new({
72 name => $name,
73 string => $string,
74 is_stored => 1,
75 is_indexed => 1,
76 is_tokenized => 0
77 });
78 }
79  
80 =head2 UnIndexed
81  
82 my $field = Plucene::Document::Field->UnIndexded($name, $string);
83  
84 This will make a new Plucene::Document::Field object that is stored, but
85 not indexed or tokenised.
86
87 =cut
88  
89 0 ▶sub UnIndexed {
Subroutine UnIndexed: not called CC=1 SCAR=6.9
Pod documented
90 0 my ($self, $name, $string) = @_;
91 0 return $self->new({
92 name => $name,
93 string => $string,
94 is_stored => 1,
95 is_indexed => 0,
96 is_tokenized => 0
97 });
98 }
99  
100 =head2 Text
101  
102 my $field = Plucene::Document::Field->Text($name, $string);
103  
104 This will make a new Plucene::Document::Field object that is stored,
105 indexed and tokenised.
106
107 =cut
108  
109 274 ▶sub Text {
Subroutine Text: called CC=1 SCAR=0.0
Pod documented
110 274 my ($self, $name, $string) = @_;
111 274 return $self->new({
112 name => $name,
113 string => $string,
114 is_stored => 1,
115 is_indexed => 1,
116 is_tokenized => 1
117 });
118 }
119  
120 =head2 UnStored
121  
122 my $field = Plucene::Document::Field->UnStored($name, $string);
123  
124 This will make a new Plucene::Document::Field object that isn't stored,
125 but is indexed and tokenised.
126  
127 =cut
128  
129 48 ▶sub UnStored {
Subroutine UnStored: called CC=1 SCAR=0.0
Pod documented
130 48 my ($self, $name, $string) = @_;
131 48 return $self->new({
132 name => $name,
133 string => $string,
134 is_stored => 0,
135 is_indexed => 1,
136 is_tokenized => 1
137 });
138 }
139  
140 18 1;
« Plucene/Analysis/Standard/StandardAnalyzer.pm ↑ Summary Plucene/Analysis/LetterTokenizer.pm »