From: "Kent Fredric" <kentfredric@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/perl-overlay:master commit in: scripts/, scripts/lib/
Date: Fri, 6 Jan 2012 16:38:01 +0000 (UTC) [thread overview]
Message-ID: <35b9a8c3d05650d4023e7b61ded134314f1f498d.kent@gentoo> (raw)
commit: 35b9a8c3d05650d4023e7b61ded134314f1f498d
Author: Kent Fredric <kentfredric <AT> gmail <DOT> com>
AuthorDate: Fri Jan 6 06:03:38 2012 +0000
Commit: Kent Fredric <kentfredric <AT> gmail <DOT> com>
CommitDate: Fri Jan 6 06:03:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=35b9a8c3
[scripts] optimise package query, fix end-point to _search, add debug options in the WWW layer
---
scripts/lib/metacpan.pm | 19 ++++++++++++++---
scripts/package_log.pl | 48 +++++++++++++++++++++++++++++-----------------
2 files changed, 45 insertions(+), 22 deletions(-)
diff --git a/scripts/lib/metacpan.pm b/scripts/lib/metacpan.pm
index 58ce0f2..702a2a9 100644
--- a/scripts/lib/metacpan.pm
+++ b/scripts/lib/metacpan.pm
@@ -20,11 +20,22 @@ sub mcpan {
root_dir => File::Spec->catdir( File::Spec->tmpdir, 'gentoo-metacpan-cache' ),
);
require WWW::Mechanize::Cached;
- my $mech = WWW::Mechanize::Cached->new(
- cache => $cache,
- timeout => 20000,
+ my $mech;
+
+ if ( defined $ENV{WWW_MECH_NOCACHE} ) {
+ $mech = LWP::UserAgent->new();
+ } else {
+ $mech = WWW::Mechanize::Cached->new(
+ cache => $cache,
+ timeout => 20000,
autocheck => 1,
- );
+ );
+ }
+ if ( defined $ENV{WWW_MECH_DEBUG} ) {
+ $mech->add_handler("request_send", sub { warn shift->dump ; return });
+ $mech->add_handler("response_done", sub { warn shift->dump ; return });
+
+ }
require HTTP::Tiny::Mech;
my $tinymech = HTTP::Tiny::Mech->new( mechua => $mech );
require MetaCPAN::API;
diff --git a/scripts/package_log.pl b/scripts/package_log.pl
index 70547b3..a6bc9fb 100755
--- a/scripts/package_log.pl
+++ b/scripts/package_log.pl
@@ -49,34 +49,45 @@ my $singleflags;
if ( $flags->{help} or $singleflags->{h} ) { print help(); exit 0; }
-my $oldest_date = '2011-09-01T00:00:00.000Z';
-my $newest_date = '2012-01-01T00:00:00.000Z';
+my $oldest_date = '2011-10-01T00:00:00.000Z';
+my $newest_date = '2012-02-01T00:00:00.000Z';
my $search = {};
-$search->{query} = {
- terms => {
- distribution => [ @ARGV, ],
- minimum_match => 1,
- },
-};
+my $and = [];
if ( not $flags->{all} ) {
- $search->{filter} = {
- range => {
- date => {
- from => $oldest_date,
- to => $newest_date,
- },
- },
- };
+ push @{$and}, {
+ range => {
+ date => {
+ from => $oldest_date,
+ to => $newest_date,
+ }
+ }
+ };
}
+
+push @{$and} , {
+ term => {
+ 'distribution' => @ARGV,
+# minimum_match => 1,
+ }
+};
+
+$search->{query} = {
+ constant_score => {
+ filter => {
+ and => $and,
+ }
+ }
+};
+
$search->{sort} = [
# { 'author' => 'asc', },
{ 'date' => 'desc', },
];
-$search->{size} = 1024;
+$search->{size} = 10;
$search->{fields} = [qw( author name date distribution version )];
@@ -84,9 +95,10 @@ if ( $flags->{deps} ) {
push @{ $search->{fields} }, '_source.dependency';
}
+
_log( ['initialized: fetching search results'] );
-my $results = mcpan->post( 'release', $search );
+my $results = mcpan->post( 'release/_search', $search );
_log( [ 'fetched %s results', scalar @{ $results->{hits}->{hits} } ] );
next reply other threads:[~2012-01-06 16:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 16:38 Kent Fredric [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-05-01 22:23 [gentoo-commits] proj/perl-overlay:master commit in: scripts/, scripts/lib/ Kent Fredric
2012-04-08 23:12 Kent Fredric
2012-04-08 23:11 Kent Fredric
2012-04-06 20:43 Kent Fredric
2012-02-25 22:14 Kent Fredric
2012-02-24 7:13 Kent Fredric
2011-11-11 14:38 Kent Fredric
2011-10-31 2:48 Kent Fredric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35b9a8c3d05650d4023e7b61ded134314f1f498d.kent@gentoo \
--to=kentfredric@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox