Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Created October 15, 2014 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kentfredric/22266f846eb6003dc842 to your computer and use it in GitHub Desktop.
Save kentfredric/22266f846eb6003dc842 to your computer and use it in GitHub Desktop.
diff --git a/lib/MetaCPAN/Client/Request.pm b/lib/MetaCPAN/Client/Request.pm
index ddd733a..3c58fcf 100644
--- a/lib/MetaCPAN/Client/Request.pm
+++ b/lib/MetaCPAN/Client/Request.pm
@@ -89,15 +89,22 @@ sub ssearch {
( $self->_has_user_ua ? ( handle => $self->_user_ua ) : () )
);
- my $scroller = Search::Elasticsearch::Scroll->new(
+ my %scroll_args = (
es => $es,
search_type => 'scan',
scroll => '5m',
index => $self->version,
type => $type,
size => 1000,
- body => $self->_build_body($args),
- %{ $params },
+ );
+
+ if ( ref $args eq 'HASH' and keys %{$args} ) {
+ $scroll_args{body} = $self->_build_body($args);
+ }
+
+ my $scroller = Search::Elasticsearch::Scroll->new(
+ %scroll_args,
+ %{$params},
);
return $scroller;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment