Page MenuHomePhabricator

Override services for getting a federated property's "title", "url" and "articleId"
Closed, ResolvedPublic

Description

TBA which API module could / shoud be used (Example call)
The path should include a note in the implementation saying that it is prefered to use the batched lookup where possible (to avoid more API calls)

Event Timeline

From what I just said in mattermost after looking at what API we could use..

I'm going to look at which APIs we can use for entity id -> title lookup right now

In theory all we need to do it 1 api call once to figure out the configured namespaces, and then from there some other title lookup implementation should be able to take that info and do the right thing...

EG. https://www.wikidata.org/w/api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics has namespace 0 with the default content model of wikibase-property.
Now that is a bit of an assumption that the namespace with wikibase-property is the only and correct namespace, but I'm pretty sure we don't really support multiple property namespaces right now so thats probably a safe assumption as long as we document it

Amusingly, if we come to that conclusion, then the work we did on making search entities do batched lookups is probably not needed...... as mutliple individual calls to get an entity title would only result in a single api call anyway

Continuing to use Title in SearchEntities might not be the best idea either.
And we should consider what to do with PageId, and if it makes sense in the result for federated properties.

Another interesting point then is, Title vs ForeignTitle.. and what that means for us.. ForeignTitle does not implement or extend Title, and thus we wouldnt be able to easily use it, so maybe we shouldnt.
But then Using Title implies that it is a local page, which I guess is kind of correct, as this "virtual" local page will be loadable in one way or another and redirect / link to the real thing / have some basic content.
So i figure sticking with Title will be okay....

Next observation is what Title is actually used for... getPrefixedText (easy) getArticleID() (harder? can't do this with just the NS), getFullURL() (easy?)

  1. does pageid make sense in the context of searchentities for federated properties? Should this be the pageid of the remote entity? or should this not be returned?

Because Title is evil (one of the more evil mediawiki core classes) getArticleID does a DB lookup / LinkCache lookup for the page id..
It might be worth investigating if we could use the more simple LinkTarget class, (Title implements this) and then some additional services for getting the URL and prefixed text. (one for prefixed text already exists in core)

I'll try to keep documenting whatever discussion happens in mattermost in this ticket too..

Change 578882 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] WIP SearchEntities only require a LinkTarget lookup

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

Change 578882 abandoned by Jakob:
SearchEntities: only require a LinkTarget lookup

Reason:
As discussed, going with LinkTarget as the input to the services determining article id, link url, and title text puts us in the awkward situation of having to derive the Entity id from the LinkTarget which is not easily doable for non-local entities, and even harder once both remote and local entities of the same type coexist.

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

Change 581650 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] SearchEntities: decouple from Title

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

Change 581982 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Make Title-related services configurable per entity type

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

Jakob_WMDE renamed this task from Implement an EntityTitleLookup that is backed by an API to Override services for getting a federated property's "title", "url" and "articleId".Mar 20 2020, 11:00 AM

Change 581990 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Override EntityArticleIdLookup for federated properties

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

Change 582004 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Add API based entity URL lookup for use with federated properties

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

Change 581650 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] SearchEntities: decouple from Title

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

Change 581982 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Make Title-related services configurable per entity type

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

Change 581990 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Override EntityArticleIdLookup for federated properties

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

Change 583070 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] EntityTitleTextLookup for federated properties in SearchEntities

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

Change 582004 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add API based entity URL lookup for use with federated properties

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

Change 583070 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] EntityTitleTextLookup for federated properties in SearchEntities

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