Od1n added a comment.
We have an use case on French wiki, where we want a list of all foreign badges of a given article. - Previously, we were retrieving the whole entity, then we could iterate the `sitelinks` table. But retrieving the whole entity was eating a lot of memory (it was a bit slow too). - Thanks to this new `getBadges()` function, a new approach has been developed: we Iterate an hardcoded of list of wikis, and we call `getBadges()` for each of these. It uses a lot less memory (and it's a bit faster too). The downside with this approach is that we have to use an hardcoded list of wikis, whereas the previous approach was exhaustively retrieving the badges. Here is the code change: https://fr.wikipedia.org/w/index.php?title=Module:Cat%C3%A9gorisation_badges&type=revision&diff=202204202&oldid=194574538 I thought about adding new functions like `getAllBadges()` or `getAllSitelinks()`, but that would introduce discrepancies with the existing functions: - if adding a `getAllBadges()` function, why not adding the same for `getSitelink()`? - but adding `getAllSitelinks()` (notice the singular/plural difference with `getSitelink()`) would be confusing, because we have the `sitelinks` table, but these functions retrieve `entity.sitelinks[globalSiteId].title` actually. To avoid confusion, another solution could be to add a `getSitelinksTable()` function. The only downside is that it still would add a function to the API, and a function that returns a "raw" table (i.e. not directly the desired properties), though this table is quite straightforward. TASK DETAIL https://phabricator.wikimedia.org/T305378 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: hoo, Od1n Cc: Od1n, Arian_Bozorg, TomT0m, Zebulon84, Tacsipacsi, Lydia_Pintscher, Aklapper, eranroz, thiemowmde, Tpt, Ladsgroup, hoo, aude, Jonas, putnik, Uzume, MisterSynergy, Vriullop, RexxS, Agabi10, RolandUnger, jberkel, Lea_Lacroix_WMDE, Pigsonthewing, Simon_Villeneuve, Thayts, ChristianKl, Manuel, LennardHofmann, Astuthiodit_1, karapayneWMDE, Invadibot, maantietaja, ItamarWMDE, Akuckartz, Nandana, lucamauri, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, Mbch331
_______________________________________________ Wikidata-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected]
