hoo created this task. hoo added projects: Wikidata, MediaWiki-extensions-WikibaseClient, Wikibase-Lua.
TASK DESCRIPTION Having convenience functions that look up all sitelinks and all badges for an item would be handy (see below). As looking up the sitelinks can be done via the sitelinks tables, but badge access needs access to the full entity (so is more expensive), we should probably split these up (so that badges are only fetched when absolutely required). --- From T305378#8726591 <https://phabricator.wikimedia.org/T305378#8726591>: In T305378#8726591 <https://phabricator.wikimedia.org/T305378#8726591>, @Od1n wrote: > 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 a 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 a 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/T338942 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: hoo Cc: Lydia_Pintscher, Aklapper, eranroz, thiemowmde, Tpt, Ladsgroup, aude, Jonas, putnik, Uzume, Ghuron, MisterSynergy, Vriullop, RexxS, Agabi10, RolandUnger, jberkel, Lea_Lacroix_WMDE, Pigsonthewing, Simon_Villeneuve, Thayts, ChristianKl, hoo, Od1n, 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 -- wikidata-bugs@lists.wikimedia.org To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org