File Coverage

blib/lib/Elastic/Model/Trait/Field.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Elastic::Model::Trait::Field;
2             $Elastic::Model::Trait::Field::VERSION = '0.52';
3 23     23   46471 use Moose::Role;
  23         62  
  23         242  
4             Moose::Util::meta_attribute_alias('ElasticField');
5              
6 23         280 use MooseX::Types::Moose qw(
7             Str HashRef ArrayRef Bool Num Int CodeRef
8 23     23   125673 );
  23         307  
9 23         415 use Elastic::Model::Types qw(
10             FieldType IndexMapping TermVectorMapping MultiFields
11             StoreMapping DynamicMapping PathMapping
12 23     23   145362 );
  23         56  
13 23     23   174558 use Carp;
  23         57  
  23         1704  
14              
15 23     23   133 use namespace::autoclean;
  23         54  
  23         265  
16              
17             #===================================
18             has 'type' => (
19             #===================================
20                 isa => FieldType,
21                 is => 'rw',
22                 predicate => 'has_type'
23             );
24              
25             #===================================
26             has 'mapping' => (
27             #===================================
28                 isa => HashRef,
29                 is => 'rw'
30             );
31              
32             #===================================
33             has 'exclude' => (
34             #===================================
35                 isa => Bool,
36                 is => 'rw'
37             );
38              
39             #===================================
40             has 'include_in_all' => (
41             #===================================
42                 isa => Bool,
43                 is => 'rw'
44             );
45              
46             #===================================
47             has 'index' => (
48             #===================================
49                 isa => IndexMapping,
50                 is => 'rw'
51             );
52              
53             #===================================
54             has 'store' => (
55             #===================================
56                 isa => StoreMapping,
57                 is => 'rw',
58                 coerce => 1
59             );
60              
61             #===================================
62             has 'multi' => (
63             #===================================
64                 isa => MultiFields,
65                 is => 'rw'
66             );
67              
68             #===================================
69             has 'index_name' => (
70             #===================================
71                 isa => Str,
72                 is => 'rw'
73             );
74              
75             #===================================
76             has 'boost' => (
77             #===================================
78                 isa => Num,
79                 is => 'rw'
80             );
81              
82             #===================================
83             has 'null_value' => (
84             #===================================
85                 isa => Str,
86                 is => 'rw'
87             );
88              
89             #===================================
90             has 'unique_key' => (
91             #===================================
92                 isa => Str,
93                 is => 'rw'
94             );
95              
96             # strings
97              
98             #===================================
99             has 'analyzer' => (
100             #===================================
101                 isa => Str,
102                 is => 'rw'
103             );
104              
105             #===================================
106             has 'index_analyzer' => (
107             #===================================
108                 isa => Str,
109                 is => 'rw'
110             );
111              
112             #===================================
113             has 'search_analyzer' => (
114             #===================================
115                 isa => Str,
116                 is => 'rw'
117             );
118              
119             #===================================
120             has 'search_quote_analyzer' => (
121             #===================================
122                 isa => Str,
123                 is => 'rw'
124             );
125              
126             #===================================
127             has 'term_vector' => (
128             #===================================
129                 isa => TermVectorMapping,
130                 is => 'rw'
131             );
132              
133             # dates
134              
135             #===================================
136             has 'format' => (
137             #===================================
138                 isa => Str,
139                 is => 'rw'
140             );
141              
142             #===================================
143             has 'precision_step' => (
144             #===================================
145                 isa => Int,
146                 is => 'rw'
147             );
148              
149             # geo-point
150              
151             #===================================
152             has 'geohash' => (
153             #===================================
154                 isa => Bool,
155                 is => 'rw'
156             );
157              
158             #===================================
159             has 'lat_lon' => (
160             #===================================
161                 isa => Bool,
162                 is => 'rw'
163             );
164              
165             #===================================
166             has 'geohash_precision' => (
167             #===================================
168                 isa => Int,
169                 is => 'rw'
170             );
171              
172             # object
173              
174             #===================================
175             has 'enabled' => (
176             #===================================
177                 isa => Bool,
178                 is => 'rw',
179                 predicate => 'has_enabled'
180             );
181              
182             #===================================
183             has 'dynamic' => (
184             #===================================
185                 isa => DynamicMapping,
186                 is => 'rw'
187             );
188              
189             #===================================
190             has 'path' => (
191             #===================================
192                 isa => PathMapping,
193                 is => 'rw'
194             );
195              
196             # nested
197              
198             #===================================
199             has 'include_in_parent' => (
200             #===================================
201                 isa => Bool,
202                 is => 'rw'
203             );
204              
205             #===================================
206             has 'include_in_root' => (
207             #===================================
208                 isa => Bool,
209                 is => 'rw'
210             );
211              
212             # deflation
213              
214             #===================================
215             has 'deflator' => (
216             #===================================
217                 isa => CodeRef,
218                 is => 'rw'
219             );
220              
221             #===================================
222             has 'inflator' => (
223             #===================================
224                 isa => CodeRef,
225                 is => 'rw'
226             );
227              
228             # esdocs
229              
230             #===================================
231             has 'include_attrs' => (
232             #===================================
233                 isa => ArrayRef [Str],
234                 is => 'rw'
235             );
236              
237             #===================================
238             has 'exclude_attrs' => (
239             #===================================
240                 isa => ArrayRef [Str],
241                 is => 'rw'
242             );
243              
244             1;
245              
246             =pod
247            
248             =encoding UTF-8
249            
250             =head1 NAME
251            
252             Elastic::Model::Trait::Field - Add Elasticsearch specific keywords to your attribute definitions.
253            
254             =head1 VERSION
255            
256             version 0.52
257            
258             =head1 DESCRIPTION
259            
260             L<Elastic::Model::Trait::Field> is automatically applied to all of your
261             attributes when you include C<use Elastic::Doc;> at the top of your doc
262             classes. This trait adds keywords to allow you to configure how each attribute
263             is indexed in Elasticsearch.
264            
265             It also wraps all attribute accessors to ensure that Elastic::Doc objects
266             are properly inflated before any attribute is accessed.
267            
268             See L<Elastic::Manual::Attributes> for an explanation of how to use these
269             keywords.
270            
271             =head1 ATTRIBUTES
272            
273             =head2 L<type|Elastic::Manual::Attributes/type>
274            
275             =head2 L<mapping|Elastic::Manual::Attributes/mapping>
276            
277             =head2 L<exclude|Elastic::Manual::Attributes/exclude>
278            
279             =head2 L<include_in_all|Elastic::Manual::Attributes/include_in_all>
280            
281             =head2 L<index|Elastic::Manual::Attributes/index>
282            
283             =head2 L<store|Elastic::Manual::Attributes/store>
284            
285             =head2 L<multi|Elastic::Manual::Attributes/multi>
286            
287             =head2 L<index_name|Elastic::Manual::Attributes/index_name> [DEPRECATED]
288            
289             =head2 L<boost|Elastic::Manual::Attributes/boost> [DEPRECATED]
290            
291             =head2 L<null_value|Elastic::Manual::Attributes/null_value>
292            
293             =head2 L<analyzer|Elastic::Manual::Attributes/analyzer>
294            
295             =head2 L<index_analyzer|Elastic::Manual::Attributes/index_analyzer>
296            
297             =head2 L<search_analyzer|Elastic::Manual::Attributes/search_analyzer>
298            
299             =head2 L<search_quote_analyzer|Elastic::Manual::Attributes/search_quote_analyzer>
300            
301             =head2 L<term_vector|Elastic::Manual::Attributes/term_vector>
302            
303             =head2 L<format|Elastic::Manual::Attributes/format>
304            
305             =head2 L<geohash|Elastic::Manual::Attributes/geohash>
306            
307             =head2 L<lat_lon|Elastic::Manual::Attributes/lat_lon>
308            
309             =head2 L<geohash_precision|Elastic::Manual::Attributes/geohash_precision>
310            
311             =head2 L<enabled|Elastic::Manual::Attributes/enabled>
312            
313             =head2 L<dynamic|Elastic::Manual::Attributes/dynamic>
314            
315             =head2 L<path|Elastic::Manual::Attributes/path> [DEPRECATED]
316            
317             =head2 L<include_in_parent|Elastic::Manual::Attributes/include_in_parent>
318            
319             =head2 L<include_in_root|Elastic::Manual::Attributes/include_in_root>
320            
321             =head2 L<deflator|Elastic::Manual::Attributes/deflator>
322            
323             =head2 L<inflator|Elastic::Manual::Attributes/inflator>
324            
325             =head2 L<include_attrs|Elastic::Manual::Attributes/include_attrs>
326            
327             =head2 L<exclude_attrs|Elastic::Manual::Attributes/exclude_attrs>
328            
329             =head1 AUTHOR
330            
331             Clinton Gormley <drtech@cpan.org>
332            
333             =head1 COPYRIGHT AND LICENSE
334            
335             This software is copyright (c) 2015 by Clinton Gormley.
336            
337             This is free software; you can redistribute it and/or modify it under
338             the same terms as the Perl 5 programming language system itself.
339            
340             =cut
341              
342             __END__
343            
344             # ABSTRACT: Add Elasticsearch specific keywords to your attribute definitions.
345            
346