line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
14
|
|
|
14
|
|
110715
|
|
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
76
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use parent 'Catmandu::Cmd'; |
7
|
14
|
|
|
14
|
|
89
|
use Catmandu; |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
67
|
|
8
|
14
|
|
|
14
|
|
833
|
use namespace::clean; |
|
14
|
|
|
|
|
31
|
|
|
14
|
|
|
|
|
65
|
|
9
|
14
|
|
|
14
|
|
2554
|
|
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
62
|
|
10
|
|
|
|
|
|
|
(["cql-query|q=s", ""], ["query=s", ""],); |
11
|
|
|
|
|
|
|
} |
12
|
1
|
|
|
1
|
1
|
10
|
|
13
|
|
|
|
|
|
|
my ($self, $opts, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my ($from_args, $from_opts) = $self->_parse_options($args); |
16
|
1
|
|
|
1
|
1
|
3
|
|
17
|
|
|
|
|
|
|
my $from_bag = delete $from_opts->{bag}; |
18
|
1
|
|
|
|
|
6
|
my $from = Catmandu->store($from_args->[0], $from_opts)->bag($from_bag); |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
3
|
if ($opts->query // $opts->cql_query) { |
21
|
1
|
|
|
|
|
7
|
$self->usage_error("Bag isn't searchable") |
22
|
|
|
|
|
|
|
unless $from->can('searcher'); |
23
|
1
|
50
|
33
|
|
|
6
|
$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
|
|
|
|
|
18
|
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 |