line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
18
|
|
99
|
use strict; |
|
18
|
|
|
|
|
232
|
|
|
18
|
|
|
|
|
675
|
|
25
|
18
|
|
|
18
|
|
93
|
use warnings; |
|
18
|
|
|
|
|
41
|
|
|
18
|
|
|
|
|
693
|
|
26
|
|
|
|
|
|
|
|
27
|
18
|
|
|
18
|
|
95
|
use base qw(Class::Accessor::Fast); |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
1943
|
|
28
|
|
|
|
|
|
|
__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. |
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. |
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 or C. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
18
|
|
|
18
|
|
182
|
use Carp qw(confess); |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
5445
|
|
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
|
|
|
|
|
|
|
sub Keyword { |
70
|
48
|
|
|
48
|
1
|
1113
|
my ($self, $name, $string) = @_; |
71
|
48
|
|
|
|
|
383
|
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
|
|
|
|
|
|
|
sub UnIndexed { |
90
|
0
|
|
|
0
|
1
|
0
|
my ($self, $name, $string) = @_; |
91
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
sub Text { |
110
|
274
|
|
|
274
|
1
|
2948
|
my ($self, $name, $string) = @_; |
111
|
274
|
|
|
|
|
10894
|
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
|
|
|
|
|
|
|
sub UnStored { |
130
|
48
|
|
|
48
|
1
|
664
|
my ($self, $name, $string) = @_; |
131
|
48
|
|
|
|
|
299
|
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
|
|
|
|
|
|
|
1; |