Page MenuHomePhabricator

pageid="0" in the search results for a interwiki search through the API
Open, LowPublicFeature

Description

With using search API query for interwiki search (&srinterwiki=1 option) we saw pageid="0" for all results from projects that are different from the initial one.

Steps to Reproduce:

As example, requested from en-wikipedia:

https://en.wikipedia.org/w/api.php?action=query&list=search&format=xml&redirects=resolve&srlimit=1&srenablerewrites=1&&srprop=snippet&srinterwiki=1&srsearch=Tolstoy

Actual Results:

<api batchcomplete="">
<continue sroffset="1" continue="-||"/>
<query>
<searchinfo totalhits="4331"/>
<search>
<p ns="0" title="Leo Tolstoy" pageid="18622119" snippet="Count Lev Nikolayevich <span class="searchmatch">Tolstoy</span> (/ˈtoʊlstɔɪ, ˈtɒl-/; Russian: Лев Николаевич Толстой, tr. Lev Nikoláyevich <span class="searchmatch">Tolstóy</span>; [lʲef nʲɪkɐˈlaɪvʲɪtɕ tɐlˈstoj] (listen);"/>
</search>
<interwikisearch>
<wikt>
<_v ns="0" title="Tolstoy" pageid="0" snippet="From Russian Толсто́й (Tolstój), from a stress variant of the ancestor of то́лстый (tólstyj, “stout”). <span class="searchmatch">Tolstoy</span> A surname​." namespace="" url="https://en.wiktionary.org/wiki/Tolstoy"/>
</wikt>
<s>
<_v ns="0" title="A Confession (Tolstoy)" pageid="0" snippet="of Исповедь (A Confession) by Leo <span class="searchmatch">Tolstoy</span> 1996511English-language translations of Исповедь (A Confession)Leo <span class="searchmatch">Tolstoy</span> English-language translations of Исповедь" namespace="" url="https://en.wikisource.org/wiki/A_Confession_(Tolstoy)"/>
</s>
<q>
<_v ns="0" title="Leo Tolstoy" pageid="0" snippet="Lev Nikolayevitch <span class="searchmatch">Tolstoy</span> [Ле́в Никола́евич Толсто́й, usually rendered Leo <span class="searchmatch">Tolstoy</span>, or sometimes Tolstoi] (9 September 1828 – 20 November 1910) was a Russian" namespace="" url="https://en.wikiquote.org/wiki/Leo_Tolstoy"/>
</q>
<b>
<_v ns="0" title="Anarchist FAQ/What is Anarchism?/3.7" pageid="0" snippet="anarchist movement with the work of the famous Russian author Leo <span class="searchmatch">Tolstoy</span>. <span class="searchmatch">Tolstoy</span> took the message of the Bible seriously and came to consider that a" namespace="" url="https://en.wikibooks.org/wiki/Anarchist_FAQ/What_is_Anarchism%3F/3.7"/>
</b>
</interwikisearch>
<interwikisearchinfo totalhits="1855"/>
</query>
</api>

Expected Results:

<api batchcomplete="">
<continue sroffset="1" continue="-||"/>
<query>
<searchinfo totalhits="4331"/>
<search>
<p ns="0" title="Leo Tolstoy" pageid="18622119" snippet="Count Lev Nikolayevich <span class="searchmatch">Tolstoy</span> (/ˈtoʊlstɔɪ, ˈtɒl-/; Russian: Лев Николаевич Толстой, tr. Lev Nikoláyevich <span class="searchmatch">Tolstóy</span>; [lʲef nʲɪkɐˈlaɪvʲɪtɕ tɐlˈstoj] (listen);"/>
</search>
<interwikisearch>
<wikt>
<_v ns="0" title="Tolstoy" pageid="6592235" snippet="From Russian Толсто́й (Tolstój), from a stress variant of the ancestor of то́лстый (tólstyj, “stout”). <span class="searchmatch">Tolstoy</span> A surname​." namespace="" url="https://en.wiktionary.org/wiki/Tolstoy"/>
</wikt>
<s>
<_v ns="0" title="A Confession (Tolstoy)" pageid="1996511" snippet="of Исповедь (A Confession) by Leo <span class="searchmatch">Tolstoy</span> 1996511English-language translations of Исповедь (A Confession)Leo <span class="searchmatch">Tolstoy</span> English-language translations of Исповедь" namespace="" url="https://en.wikisource.org/wiki/A_Confession_(Tolstoy)"/>
</s>
<q>
<_v ns="0" title="Leo Tolstoy" pageid="143" snippet="Lev Nikolayevitch <span class="searchmatch">Tolstoy</span> [Ле́в Никола́евич Толсто́й, usually rendered Leo <span class="searchmatch">Tolstoy</span>, or sometimes Tolstoi] (9 September 1828 – 20 November 1910) was a Russian" namespace="" url="https://en.wikiquote.org/wiki/Leo_Tolstoy"/>
</q>
<b>
<_v ns="0" title="Anarchist FAQ/What is Anarchism?/3.7" pageid="219749" snippet="anarchist movement with the work of the famous Russian author Leo <span class="searchmatch">Tolstoy</span>. <span class="searchmatch">Tolstoy</span> took the message of the Bible seriously and came to consider that a" namespace="" url="https://en.wikibooks.org/wiki/Anarchist_FAQ/What_is_Anarchism%3F/3.7"/>
</b>
</interwikisearch>
<interwikisearchinfo totalhits="1855"/>
</query>
</api>

Event Timeline

Kaganer created this task.Apr 19 2020, 12:51 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 19 2020, 12:51 AM
Kaganer renamed this task from pageid="0" in the search results for a interwiki search over the API to pageid="0" in the search results for a interwiki search through the API.Apr 19 2020, 12:51 AM
Restricted Application added a project: Platform Engineering. · View Herald TranscriptApr 19 2020, 1:01 AM
Reedy updated the task description. (Show Details)Apr 19 2020, 1:33 PM

It is not possible to get the pageid from external wikis. All the entries with pageid = 0 have an url pointing to a different wiki.

daniel triaged this task as Low priority.Apr 20 2020, 7:44 PM
daniel changed the subtype of this task from "Bug Report" to "Feature Request".
daniel moved this task from Inbox to Feature Requests to Review on the Platform Engineering board.
daniel added a subscriber: daniel.

Changing this to a feature request. It's not a bug, since the code is working as intended, and page ID 0 (i.e. "unknown") is correct in the context of the local wiki.
Returning the page ID relative to another project is not impossible, but may lead to misunderstandings.

Restricted Application added a project: Discovery-Search. · View Herald TranscriptJul 30 2020, 10:00 PM