Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add example for facets in 'all' query
  • Loading branch information
mickeyn committed Jan 27, 2015
1 parent dde60ed commit 0e85828
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/all_favorite_counts_per_dist.pl
@@ -0,0 +1,25 @@
use strict;
use warnings;
use Data::Printer;

use MetaCPAN::Client;

# All 1+ favorite counts per distributions
# -- done inefficiently :)

my $mcpan = MetaCPAN::Client->new();
my $size = $mcpan->all('favorites')->total;
my $favs = $mcpan->all('favorites', {
facets => {
distribution => {
terms => {
field => "distribution",
size => $size,
order => "reverse_count",
# all_terms => "true",
}
},
}
});

p $favs->facets->{distribution}{terms};

0 comments on commit 0e85828

Please sign in to comment.