Page MenuHomePhabricator

Increase pilimit default value from 1 to PARAM_MAX
Closed, ResolvedPublic1 Estimated Story Points


I was playing with the pageimages API today, in preparation for the Multimedia team's work for next quarter, and I spent about 30 minutes trying to debug PageImages and core, because I overlooked the fine print on the API documentation that explains PageImages will only return one result by default.

As far as I can tell, getting the images is a reasonably performant process, and it won't crash the servers to fetch results for a few more pages in the set. However, I'd be interested to know the rationale for the low default.

We should increase the pilimit by default to 10 or max (50 right now) to avoid the confusing behavior when using the api and only getting an image for the first result on the query.

Developer notes

Update includes/ApiQueryPageImages.php ApiBase::PARAM_DFLT in getAllowedParams() from 1 to 50.

Event Timeline

ovasileva triaged this task as Medium priority.Dec 21 2016, 5:40 PM

@MarkTraceur you already can get multiple images, .e.g|page_image_free&titles=Barack%20Obama|Avatar%20(2009%20film)

But, I suppose you want to get the images using the pageimages API. If I remember correctly, you had to pass in an additional query parameter. @MaxSem do you know what it was?

I suppose so. But I'm specifically talking about prop=pageimages here (and prop=extracts in the companion bug about TextExtracts)

Jdlrobson added a subscriber: Jdlrobson.

Open question: What should the new default limit be? max ? some other integer?

/me is confused because the limit is 50/500 for bots.

@MarkTraceur how many images do you want to retrieve? We're trying to define some hard limits.

Jhernandez renamed this task from 1 seems like an unnecessarily strict default limit for number of pageimages returned from API to Increase pilimit to a number bigger than 1.Apr 11 2017, 3:45 PM
Jhernandez updated the task description. (Show Details)
Jhernandez added a subscriber: Jhernandez.

I'd default to something like 10, or max if it is not a problem really.

I'd vote for PARAM_MAX (50) as this should cover most requests. Note that this would then only impact API requests returning more than 50 articles. The API already errors when you request too many so this would mean no headaches for API users.

Jdlrobson renamed this task from Increase pilimit to a number bigger than 1 to Increase pilimit default value from 1 to PARAM_MAX.Apr 11 2017, 5:16 PM

Should we send an email after we're done to mediawiki-api-announce? (with both of the similar tasks)

Change 354471 had a related patch set uploaded (by Bmansurov; owner: Bmansurov):
[mediawiki/extensions/PageImages@master] Increase default API limit from 1 to 50

Change 354471 merged by jenkins-bot:
[mediawiki/extensions/PageImages@master] Increase default API limit from 1 to 50

phuedx added a subscriber: phuedx.

I can sign this off today.

The patch has a request to decrease the limit from 50 to 10. @Jdlrobson should we re-open the task, or do we have a strong reason to keep 50?

I'm about to merge a patch ( updating our API calls in light of this change. Please give me a ping if the pilimit default is revised again...

@Mholloway no change was necessary. We only changed default. In fact I'd recommend you continue to explicitly definite pilimit in case it does change...