Nothing Special   »   [go: up one dir, main page]

Page MenuHomePhabricator

API lacks a method to query redirects to a title
Closed, ResolvedPublic

Description

To show the redirects to a title you can use the link:

https://de.wikipedia.org/w/index.php?title=Special:WhatLinksHere/Berlin&hidelinks=1

For the article [[de:Berlin]] the following 4 redirects exist:

  • [[de:Land Berlin]]
  • [[de:DE-BE]]
  • [[de:Freie Hansestadt Berlin]]
  • [[de:Stadt Berlin]]

The API has the following query:

https://de.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Berlin&blfilterredir=redirects&bllimit=50

The response contains 31 items:
<?xml version="1.0"?>
<api>

<query>
  <backlinks>
    <bl pageid="598689" ns="0" title="Land Berlin" redirect="" />
    <bl pageid="830872" ns="0" title="DE-BE" redirect="" />
    <bl pageid="1131942" ns="0" title="Max Contag" redirect="" />
    <bl pageid="1131945" ns="0" title="Christian Havestadt" redirect="" />
    <bl pageid="1192706" ns="0" title="Willi Freitag" redirect="" />
    <bl pageid="1361427" ns="0" title="Roger Rossmeisl" redirect="" />
    <bl pageid="2369732" ns="0" title="Elisabeth Concordia Crola" redirect="" />
    <bl pageid="2440334" ns="0" title="Felicie Bernstein" redirect="" />
    <bl pageid="2536783" ns="0" title="Carl Bernstein (Kunstsammler)" redirect="" />
    <bl pageid="2782294" ns="0" title="Jörg Hartmann (Maueropfer)" redirect="" />
    <bl pageid="2782381" ns="0" title="Lothar Schleusener" redirect="" />
    <bl pageid="4282137" ns="0" title="Mieze Katz" redirect="" />
    <bl pageid="4506411" ns="0" title="Mark Lehmstedt" redirect="" />
    <bl pageid="4530698" ns="0" title="Eckhard Wehage" redirect="" />
    <bl pageid="4530700" ns="0" title="Christel Wehage" redirect="" />
    <bl pageid="4778961" ns="0" title="Brigitte Matschinsky-Denninghoff" redirect="" />
    <bl pageid="5035043" ns="0" title="Lucie Berlin" redirect="" />
    <bl pageid="5240111" ns="0" title="Matthias Nowak" redirect="" />
    <bl pageid="5288707" ns="0" title="Otto Freitag (Fußballspieler)" redirect="" />
    <bl pageid="5629793" ns="0" title="Jean-Rodrique Funke" redirect="" />
    <bl pageid="5684248" ns="0" title="Wolfgang Preuß" redirect="" />
    <bl pageid="6239882" ns="0" title="Sven Gillert" redirect="" />
    <bl pageid="6469922" ns="0" title="Freie Hansestadt Berlin" redirect="" />
    <bl pageid="7110028" ns="0" title="Augustin Terwesten" redirect="" />
    <bl pageid="7117879" ns="0" title="Lucius Reichling" redirect="" />
    <bl pageid="7441473" ns="0" title="BND-Zentrale" redirect="" />
    <bl pageid="7545608" ns="0" title="Sayed Kamal" redirect="" />
    <bl pageid="7610976" ns="0" title="Minnie Maria Kronfeld" redirect="" />
    <bl pageid="7664773" ns="0" title="Iwan Kutisker" redirect="" />
    <bl pageid="7752064" ns="0" title="Stadt Berlin" redirect="" />
    <bl pageid="7766833" ns="0" title="Wilhelm Olschewski junior" redirect="" />
  </backlinks>
</query>

</api>

All items are redirects. But only 4 redirect to the article [[de:Berlin]]. The other redirects redirect to other articles. But they contain an invisible link to [[de:Berlin]].

Is this a bug or is there an other API query to get only the redirects to the title?


Version: 1.23.0
Severity: enhancement

Details

Reference
bz57057

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:39 AM
bzimport set Reference to bz57057.

This is a bug, because only the page_is_redirect field is checked on api, not, if the redirect page has the correct target.

Special:Whatlinkshere is checking the redirect table with a LEFT JOIN.

(In reply to comment #1)

This is a bug, because only the page_is_redirect field is checked on api,

No it's not. list=backlinks is doing exactly what it's supposed to do here.

(In reply to comment #0)

or is there an other API query to get only the redirects to the title?

No, there isn't. And that *is* a bug. Retitling and adjusting accordingly.

Change 104764 had a related patch set uploaded by Anomie:
API: Add prop=redirects and list=allredirects

https://gerrit.wikimedia.org/r/104764

Change 104764 merged by jenkins-bot:
API: Add prop=redirects and list=allredirects

https://gerrit.wikimedia.org/r/104764

This should be deployed to WMF sites with 1.23wmf16, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.