Page MenuHomePhabricator

Unable to get page redirect targets when using list=allpages
Closed, DuplicatePublic

Description

Per docs, it seems there is no way to enumerate all pages in the DB while also getting their redirect targets.

This query should not error out, but return useful results:
action=query & generator=allpages & gaplimit=max & redirects

Instead, it errors because of an internal optimization (which I'm guilty of). In theory, the prop=info should have returned the redirect target instead, but it also does not support this.

Event Timeline

Yurik created this task.Feb 7 2019, 5:17 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 7 2019, 5:17 AM

In theory, the prop=info should have returned the redirect target instead, but it also does not support this.

I agree. Marking as a duplicate of T31115: add redirect target value on page info (ApiQueryInfo).

Have you try prop=redirect? Your linked doc is for the case to resolve redirect, that means going from redirect to page. Try the the other way, going from page to all its redirects (0..N)

https://www.mediawiki.org/w/api.php?action=query&generator=allpages&gaplimit=max&gapfilterredir=nonredirects&prop=redirects&rdlimit=max&formatversion=2

@Umherirrender that's an interesting idea, thx. It is not exactly the same because this wouldn't get me the redirect to redirect - e.g. A->B->C would only get me B->C without A->C.