MetaCPAN-Client icon indicating copy to clipboard operation
MetaCPAN-Client copied to clipboard

->reverse_dependencies returns only 50 results even if there are more

Open wchristian opened this issue 1 year ago • 5 comments

MetaCPAN::Client->reverse_dependencies returns only 50 results even if there are more, and doesn't automatically fetch more results if ->next on the resultset runs out of those 50

it seems MetaCPAN::Client wants to pass the request size via the POST parameters, but they're ignored unless they're in the query url

this monkeypatch seems to make it do the right thing:

my $old_fetch = \&MetaCPAN::Client::fetch;
my $new_fetch = sub { $old_fetch->( shift, shift . "?size=5000", @_ ) };
{ no warnings 'redefine'; *MetaCPAN::Client::fetch = $new_fetch; }

from IRC:

<haarg> it seems to be trying to pass an ES query, but the api isn't expecting that
<alh> reverse_dependencies() uses items instead of a scroller so it'll never fetch the next page if I'm reading it right
<alh> Or is the 'size => 5000' supposed to just "grab them all in one go" 
<haarg> the extra arguments it passes are entirely ignored
<haarg> because that end point wants form type params (GET or POST) not a json body

wchristian avatar Feb 23 '24 14:02 wchristian

Yeah I see the problem, the ES query is passed as an ignored param. the internal API query does the same without the size value. I'll patch that.

mickeyn avatar Feb 28 '24 20:02 mickeyn

@mickeyn do you know where we are on this?

oalders avatar Sep 03 '24 15:09 oalders

@oalders sorry I put this one aside for too long. I'll try to handle it soon.

mickeyn avatar Sep 04 '24 07:09 mickeyn

No worries, @mickeyn. I don't think it's urgent. 😄

oalders avatar Sep 04 '24 13:09 oalders