File Coverage

blib/lib/OpenSearch/Parameters/Search/Search.pm
Criterion Covered Total %
statement 15 16 93.7
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 23 86.9


line stmt bran cond sub pod time code
1             package OpenSearch::Parameters::Search::Search;
2 4     4   2846 use strict;
  4         10  
  4         156  
3 4     4   19 use warnings;
  4         9  
  4         239  
4 4     4   28 use feature qw(state);
  4         9  
  4         473  
5 4     4   26 use Types::Standard qw(Str Bool Int ArrayRef HashRef);
  4         7  
  4         47  
6 4     4   10030 use Moo::Role;
  4         7  
  4         35  
7              
8             #use OpenSearch::Filter::Source;
9              
10             with 'OpenSearch::Parameters';
11              
12             has 'index' => (
13             is => 'rw',
14             isa => Str,
15             );
16              
17             has 'sort' => (
18             is => 'rw',
19             isa => ArrayRef [HashRef],
20             );
21              
22             has 'version' => (
23             is => 'rw',
24             isa => Bool,
25             );
26              
27             has 'timeout' => (
28             is => 'rw',
29             isa => Str,
30             );
31              
32             has 'terminate_after' => (
33             is => 'rw',
34             isa => Int,
35             );
36              
37             has 'stats' => (
38             is => 'rw',
39             isa => Str,
40             );
41              
42             has '_source' => (
43             is => 'rw',
44              
45             # TODO
46             #isa => 'OpenSearch::Filter::Source | Str',
47             isa => Str,
48             description => {
49             encode_func => 'as_is',
50             type => 'body',
51             }
52             );
53              
54             has 'size' => (
55             is => 'rw',
56             isa => Int,
57             );
58              
59             has 'seq_no_primary_term' => (
60             is => 'rw',
61             isa => Bool,
62             );
63              
64             has 'query' => (
65             is => 'rw',
66             isa => HashRef,
67             );
68              
69             has 'min_score' => (
70             is => 'rw',
71             isa => Int,
72             );
73              
74             has 'indices_boost' => (
75             is => 'rw',
76             isa => ArrayRef [HashRef],
77             );
78              
79             has 'from' => (
80             is => 'rw',
81             isa => Int,
82             );
83              
84             has 'explain' => (
85             is => 'rw',
86             isa => Str,
87             );
88              
89             has 'fields' => (
90             is => 'rw',
91             isa => ArrayRef,
92             );
93              
94             has 'docvalue_fields' => (
95             is => 'rw',
96             isa => ArrayRef [HashRef],
97             );
98              
99             has 'aggs' => (
100             is => 'rw',
101             isa => HashRef,
102             );
103              
104             has 'search_after' => (
105             is => 'rw',
106             isa => ArrayRef,
107             );
108              
109             has 'scroll_id' => (
110             is => 'rw',
111             isa => Str,
112             );
113              
114             has 'max_concurrent_shard_requests' => (
115             is => 'rw',
116             isa => Int,
117             );
118              
119             has 'stored_fields' => (
120             is => 'rw',
121             isa => Bool,
122             );
123              
124             has 'ignore_throttled' => (
125             is => 'rw',
126             isa => Bool,
127             );
128              
129             has 'allow_no_indices' => (
130             is => 'rw',
131             isa => Bool,
132             );
133              
134             has 'q' => (
135             is => 'rw',
136             isa => Str,
137             );
138              
139             has 'request_cache' => (
140             is => 'rw',
141             isa => Bool,
142             );
143              
144             has 'analyze_wildcard' => (
145             is => 'rw',
146             isa => Bool,
147             );
148              
149             has 'suggest_text' => (
150             is => 'rw',
151             isa => Str,
152             );
153              
154             has 'rest_total_hits_as_int' => (
155             is => 'rw',
156             isa => Bool,
157             );
158              
159             has 'routing' => (
160             is => 'rw',
161             isa => Str,
162             );
163              
164             # See https://github.com/localh0rst/OpenSearch-Perl/issues/8
165             has 'track_total_hits' => (
166             is => 'rw',
167             isa => Str,
168             );
169              
170             has 'cancel_after_time_interval' => (
171             is => 'rw',
172             isa => Str,
173             );
174              
175             has '_source_includes' => (
176             is => 'rw',
177             isa => Str,
178             );
179              
180             has 'pre_filter_shard_size' => (
181             is => 'rw',
182             isa => Int,
183             );
184              
185             has 'suggest_field' => (
186             is => 'rw',
187             isa => Str,
188             );
189              
190             has 'preference' => (
191             is => 'rw',
192             isa => Str,
193             );
194              
195             has 'suggest_size' => (
196             is => 'rw',
197             isa => Int,
198             );
199              
200             has 'default_operator' => (
201             is => 'rw',
202             isa => Str,
203             );
204              
205             has 'suggest_mode' => (
206             is => 'rw',
207             isa => Str,
208             );
209              
210             has 'allow_partial_search_results' => (
211             is => 'rw',
212             isa => Bool,
213             );
214              
215             has 'search_type' => (
216             is => 'rw',
217             isa => Str,
218             );
219              
220             has 'expand_wildcards' => (
221             is => 'rw',
222             isa => Str,
223             );
224              
225             has 'typed_keys' => (
226             is => 'rw',
227             isa => Bool,
228             );
229              
230             has 'ignore_unavailable' => (
231             is => 'rw',
232             isa => Bool,
233             );
234              
235             has 'df' => (
236             is => 'rw',
237             isa => Str,
238             );
239              
240             has 'batched_reduce_size' => (
241             is => 'rw',
242             isa => Int,
243             );
244              
245             has 'analyzer' => (
246             is => 'rw',
247             isa => Str,
248             );
249              
250             has '_source_excludes' => (
251             is => 'rw',
252             isa => Str,
253             );
254              
255             has 'track_scores' => (
256             is => 'rw',
257             isa => Bool,
258             );
259              
260             has 'lenient' => (
261             is => 'rw',
262             isa => Bool,
263             );
264              
265             has 'ccs_minimize_roundtrips' => (
266             is => 'rw',
267             isa => Bool,
268             );
269              
270             has 'scroll' => (
271             is => 'rw',
272             isa => Str,
273             );
274              
275             has 'highlight' => (
276             is => 'rw',
277             isa => HashRef,
278             );
279              
280             has 'profile' => (
281             is => 'rw',
282             isa => Bool,
283             );
284              
285             around [
286             qw/
287             index sort version timeout terminate_after stats _source size seq_no_primary_term
288             query min_score indices_boost from explain fields docvalue_fields aggs
289             search_after scroll_id max_concurrent_shard_requests stored_fields ignore_throttled
290             allow_no_indices q request_cache analyze_wildcard suggest_text rest_total_hits_as_int
291             routing track_total_hits cancel_after_time_interval _source_includes pre_filter_shard_size
292             suggest_field preference suggest_size default_operator suggest_mode allow_partial_search_results
293             search_type expand_wildcards typed_keys ignore_unavailable df batched_reduce_size analyzer
294             _source_excludes track_scores lenient ccs_minimize_roundtrips scroll highlight profile
295             /
296             ] => sub {
297             my $orig = shift;
298             my $self = shift;
299              
300             if (@_) {
301             $self->$orig(@_);
302             return ($self);
303             }
304             return ( $self->$orig );
305             };
306              
307             sub api_spec {
308 0     0 0   state $s = +{
309             index => {
310             encode_func => 'as_is',
311             type => 'path',
312             },
313             sort => {
314             encode_func => 'as_is',
315             type => 'body',
316             },
317             version => {
318             encode_func => 'encode_bool',
319             type => 'body',
320             },
321             timeout => {
322             encode_func => 'as_is',
323             type => 'body',
324             },
325             terminate_after => {
326             encode_func => 'as_is',
327             type => 'body',
328             },
329             stats => {
330             encode_func => 'as_is',
331             type => 'body',
332             },
333             _source => {
334             encode_func => 'as_is',
335             type => 'body',
336             },
337             size => {
338             encode_func => 'as_is',
339             type => 'body',
340             },
341             seq_no_primary_term => {
342             encode_func => 'encode_bool',
343             type => 'body',
344             },
345             query => {
346             encode_func => 'as_is',
347             type => 'body',
348             },
349             min_score => {
350             encode_func => 'as_is',
351             type => 'body',
352             },
353             indices_boost => {
354             encode_func => 'as_is',
355             type => 'body',
356             },
357             from => {
358             encode_func => 'as_is',
359             type => 'body',
360             },
361             explain => {
362             encode_func => 'as_is',
363             type => 'body',
364             },
365             fields => {
366             encode_func => 'as_is',
367             type => 'body',
368             },
369             docvalue_fields => {
370             encode_func => 'as_is',
371             type => 'body',
372             },
373             aggs => {
374             encode_func => 'as_is',
375             type => 'body',
376             },
377             search_after => {
378             encode_func => 'as_is',
379             type => 'body',
380             },
381             scroll_id => {
382             encode_func => 'as_is',
383             type => 'body',
384             },
385             max_concurrent_shard_requests => {
386             encode_func => 'as_is',
387             type => 'url',
388             },
389             stored_fields => {
390             encode_func => 'encode_bool',
391             type => 'url',
392             },
393             ignore_throttled => {
394             encode_func => 'encode_bool',
395             type => 'url',
396             },
397             allow_no_indices => {
398             encode_func => 'encode_bool',
399             type => 'url',
400             },
401             q => {
402             encode_func => 'as_is',
403             type => 'url',
404             },
405             request_cache => {
406             encode_func => 'encode_bool',
407             type => 'url',
408             },
409             analyze_wildcard => {
410             encode_func => 'encode_bool',
411             type => 'url',
412             },
413             suggest_text => {
414             encode_func => 'as_is',
415             type => 'url',
416             },
417             rest_total_hits_as_int => {
418             encode_func => 'encode_bool',
419             type => 'url',
420             },
421             routing => {
422             encode_func => 'as_is',
423             type => 'url',
424             },
425             track_total_hits => {
426             encode_func => 'as_is',
427             type => 'url',
428             },
429             cancel_after_time_interval => {
430             encode_func => 'as_is',
431             type => 'url',
432             },
433             _source_includes => {
434             encode_func => 'as_is',
435             type => 'url',
436             },
437             pre_filter_shard_size => {
438             encode_func => 'as_is',
439             type => 'url',
440             },
441             suggest_field => {
442             encode_func => 'as_is',
443             type => 'url',
444             },
445             preference => {
446             encode_func => 'as_is',
447             type => 'url',
448             },
449             suggest_size => {
450             encode_func => 'as_is',
451             type => 'url',
452             },
453             default_operator => {
454             encode_func => 'as_is',
455             type => 'url',
456             },
457             suggest_mode => {
458             encode_func => 'as_is',
459             type => 'url',
460             },
461             allow_partial_search_results => {
462             encode_func => 'encode_bool',
463             type => 'url',
464             },
465             search_type => {
466             encode_func => 'as_is',
467             type => 'url',
468             },
469             expand_wildcards => {
470             encode_func => 'as_is',
471             type => 'url',
472             },
473             typed_keys => {
474             encode_func => 'encode_bool',
475             type => 'url',
476             },
477             ignore_unavailable => {
478             encode_func => 'encode_bool',
479             type => 'url',
480             },
481             df => {
482             encode_func => 'as_is',
483             type => 'url',
484             },
485             batched_reduce_size => {
486             encode_func => 'as_is',
487             type => 'url',
488             },
489             analyzer => {
490             encode_func => 'as_is',
491             type => 'url',
492             },
493             _source_excludes => {
494             encode_func => 'as_is',
495             type => 'url',
496             },
497             track_scores => {
498             encode_func => 'encode_bool',
499             type => 'url',
500             },
501             lenient => {
502             encode_func => 'encode_bool',
503             type => 'url',
504             },
505             ccs_minimize_roundtrips => {
506             encode_func => 'encode_bool',
507             type => 'url',
508             },
509             scroll => {
510             encode_func => 'as_is',
511             type => 'url',
512             },
513             highlight => {
514             encode_func => 'as_is',
515             type => 'body',
516             },
517             profile => {
518             encode_func => 'encode_bool',
519             type => 'body',
520             },
521             };
522             }
523              
524             1;