Mailing List Archive

APIi page generator namespace order
Hi,
I query special pages through API (concretely Special:UnconnectedPages),
and I noticed that main namespace articles are yielded first.
It seems that pages are ordered by namespace numbers.
Is it a guaranteed behaviour?

(If so, I can break from the loop at te first page not in 0 namespace which
would be nice.)


--
Bináris
Re: APIi page generator namespace order [ In reply to ]
For Special:UnconnectedPages in particular, we designed the underlying page
property so that it can be efficiently sorted or filtered by namespace (see
T300770 <https://phabricator.wikimedia.org/T300770> for details), so the
fact that it starts with main namespace pages is intentional and guaranteed
by the current code; I’d say this is unlikely to change soon, but I also
don’t think we consider it covered by the Wikidata Stable Interface Policy
<https://www.wikidata.org/wiki/Wikidata:Stable_Interface_Policy>.

For other query pages, it depends on the particular page; for
instance, Special:PagesWithProp
sorts by page_id
<https://gerrit.wikimedia.org/g/mediawiki/core/+/5fc28ecc5b/includes/specials/SpecialPagesWithProp.php#207>
and Special:ShortPages by page_len
<https://gerrit.wikimedia.org/g/mediawiki/core/+/5fc28ecc5b/includes/specials/SpecialShortPages.php#158>,
if I’m reading the code correctly.

Am Do., 22. Feb. 2024 um 06:36 Uhr schrieb Bináris <wikiposta@gmail.com>:

> Hi,
> I query special pages through API (concretely Special:UnconnectedPages),
> and I noticed that main namespace articles are yielded first.
> It seems that pages are ordered by namespace numbers.
> Is it a guaranteed behaviour?
>
> (If so, I can break from the loop at te first page not in 0 namespace
> which would be nice.)
>
>
> --
> Bináris
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/



--
Lucas Werkmeister (he/er)
Software Engineer

Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30-577 11 62-0
https://wikimedia.de

Imagine a world in which every single human being can freely share in the
sum of all knowledge. Help us to achieve our vision!
https://spenden.wikimedia.de

Wikimedia Deutschland — Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Charlottenburg, VR 23855 B.
Als gemeinnützig anerkannt durch das Finanzamt für Körperschaften I Berlin,
Steuernummer 27/029/42207.
Re: APIi page generator namespace order [ In reply to ]
Great, thank you! :)