line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
14
|
|
|
14
|
|
130859
|
|
|
14
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
91
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use parent 'Catmandu::Cmd'; |
7
|
14
|
|
|
14
|
|
98
|
use Catmandu; |
|
14
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
61
|
|
8
|
14
|
|
|
14
|
|
878
|
use namespace::clean; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
64
|
|
9
|
14
|
|
|
14
|
|
2800
|
|
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
73
|
|
10
|
|
|
|
|
|
|
(["cql-query|q=s", ""], ["query=s", ""],); |
11
|
|
|
|
|
|
|
} |
12
|
1
|
|
|
1
|
1
|
17
|
|
13
|
|
|
|
|
|
|
my ($self, $opts, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my ($from_args, $from_opts) = $self->_parse_options($args); |
16
|
1
|
|
|
1
|
1
|
4
|
|
17
|
|
|
|
|
|
|
my $from_bag = delete $from_opts->{bag}; |
18
|
1
|
|
|
|
|
8
|
my $from = Catmandu->store($from_args->[0], $from_opts)->bag($from_bag); |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
3
|
if ($opts->query // $opts->cql_query) { |
21
|
1
|
|
|
|
|
13
|
$self->usage_error("Bag isn't searchable") |
22
|
|
|
|
|
|
|
unless $from->can('searcher'); |
23
|
1
|
50
|
33
|
|
|
8
|
$from = $from->searcher( |
24
|
0
|
0
|
|
|
|
0
|
cql_query => $opts->cql_query, |
25
|
|
|
|
|
|
|
query => $opts->query, |
26
|
0
|
|
|
|
|
0
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
say $from->count; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
40
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Catmandu::Cmd::count - count the number of items in a bag |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 EXAMPLES |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
catmandu count <STORE> <OPTIONS> |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
catmandu count ElasticSearch --index-name shop --bag products \ |
46
|
|
|
|
|
|
|
--query 'brand:Acme' |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
catmandu help store ElasticSearch |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SEE ALSO |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
To count the number of items from an importer, use L<Catmandu::Exporter::Count>. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |