Page MenuHomePhabricator

Integrate MediaSearch backend into Visual Editor
Closed, ResolvedPublic

Description

VE's API request for retrieving files from Commons is already with the right set of parameters that will invoke media search once it becomes a default profile.

We could slightly enhance it (if desirable) by passing along a language, which would help us inform which entities to include (or exclude, because they're likely irrelevant/undesirable in that language). This could be either:

  • the wiki's content language
  • the user's interface language

I suggest the interface language, because:

  • that's the principle we use on Commons as well
  • that can be changed by the user should they need to tweak things to find a better image (they can't change the default wiki language)

Event Timeline

AFAICT, VisualEditor already performs the perfect API call that will receive mediasearch results once the new profile is activated by default (so: blocked on T262271)
Work for this ticket will likely be a simple verification.

@matthiasmullie does that mean that when we complete T262271 that Visual Editor will automatically switch to using MediaSearch? What about default Commons search?

Yes for VE.

Default Commons search: yes, under certain conditions (=only searching NS_FILE namespace), which are not the default conditions (other namespaces are also selected by default).
So barely any "default search" sessions will likely use mediasearch profile.

That's very good to know, thanks! I'm going to add the ReleaseCandidate milestone to T262271 and put a note that we should make sure we're confident before we go ahead and merge that one.

@matthiasmullie will this affect file namespace searches on the wikipedias?

@matthiasmullie will this affect file namespace searches on the wikipedias?

No. While it uses the same search index, it doesn't use the Commons-specific media search profile. Wikipedia's file search results will not change.

Change 631394 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/core@master] Search files in user language

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

Change 631394 merged by jenkins-bot:
[mediawiki/core@master] Search files in user language

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

@ppelberg just a heads up that this has been merged and will be on next week's train!

@matthiasmullie the description of this task talks about passing through the interface language - is that part of this patch or should we remove it from the description/file it as a future enhancement?

Yes, that is in the patch that has been merged.

R4356th subscribed.

Adding User-notice as this is included in the upcoming publication of Tech News.

Etonkovidova subscribed.

During testing for wmf.32 deployment I noticed that VE Media search is slower than Special:MediaSearch on commons. Repeated searches (the searches run second time with the same search terms) run significantly faster.

Thanks to @matthiasmullie it was explained. Copying the explanation here from the chat:

VE simply also requests the “extended metadata” for the search results (which they use to show the image text at the bottom).

Part of that extended metadata is generated by Extension:CommonsMetadata, by parsing the file page content.
And unless those results are fresh in cache (which explains why repeat requests are faster), parsing the pages for all the results will take some time.

(Which is exactly why we don’t request that data in Special:MediaSearch - we used to at some point, but it was too slow for a large resultset - we now only request that extended metadata for quickview, where we only need it for 1 file, which is fast enough)

  NODES
chat 1
Note 4
Project 6
Verify 2