Page MenuHomePhabricator

API Listredirects results should contain target/to title
Closed, ResolvedPublic

Description

It seems to be impossible to get, using the MW API, a similar result like
https://en.wikipedia.org/wiki/Special:ListRedirects

"list=querypage&qppage=Listredirects" returns only a list of "from" without giving the "to" (target) title. Same for "list=allpages&apfilterredir=redirects".

This is annoying because it seems to exist no solution to find quickly all redirects (from/to) in a MW instance.


Version: 1.22.0
Severity: enhancement

Details

Reference
bz50981

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:00 AM
bzimport set Reference to bz50981.
bzimport added a subscriber: Unknown Object (MLST).

ApiQueryQueryPage just uses the "namespace", "title", and "value" columns from the QueryPage, which are also all that is stored in the querycache table.

Special:Listredirects either (if not cached) loads extra columns or (if cached) does additional database queries in its formatResult() method, which the API module has no way of knowing about.

At the moment, your best bet is to use action=query&list=allpages&apfilterredir=redirects to get a list of redirects, and then make a second call to action=query&redirects=1&pageids=... (specifying all the pageids from the first query, no prop module need be specified) to get the targets.

To really fix this, it should be easy enough to add an option to ApiQueryInfo to return the information from the redirects table, very much along the lines of how it already handles inprop=displaytitle. Then we would also add Listredirects to the $uselessQueryPages list in ApiQueryQueryPage, since generator=allpages&gapfilterredir=redirects&prop=info&inprop=<something> would be entirely equivalent.

Thank you Brad for your feedback. If this is not so complicated, I will have a look to the code and try to implement inprop=redirect. Hope to have it then reviewed...

adding the redirect target to prop=info is bug 29115

Seems to me to be a duplicate. Thx Umherirrender.

  • This bug has been marked as a duplicate of bug 29115 ***