On the search results page on some wikis (e.g. frwiki) there's a "multimedia" widget that searches in the File namespace and displays some images
The images are retrieved by calling the local search api (which falls back to commons). The results are terrible because it's a text-based search that doesn't use the work we did with structured data
Example search for "cheval" (horse) on frwiki https://fr.wikipedia.org/w/index.php?search=cheval&title=Sp%C3%A9cial:Recherche&profile=advanced&fulltext=1&ns0=1 ... the multimedia widget is at the bottom of the right-hand column
MediaSearch for "cheval" as a contrast https://commons.wikimedia.org/w/index.php?search=cheval&title=Special:MediaSearch&go=Go&type=image&uselang=fr
There are 2 possible ways to improve this:
The slightly hacky way
Update the query that the widget uses so it hits commons directly
Pros:
probably quicker to implement
Cons:
would need to update the urls returned from the search api call, to update "File:" to "Fichier:" or whatever the namespace is in the local language
will miss any images from the local wiki
The perhaps-cleaner way
Update the fallback-to-commons mechanism when searching in the File namespace more generally, so that it makes use of the new media queries
Pros:
will return the correct urls
Cons:
probably will take longer
possibly need to split the search part of WikibaseMediaInfo into its own extension (or port it into CirrusSearch) so that we don't have to deploy the full WikibaseMediaInfo everywhere we want to do this (or, alternatively, we could investigate how well WikibaseMediaInfo would work outside commons ...)
This ticket is to look at bit more closely at both approaches so as to get a better idea of the details of implementation, so we can make a more informed decision about how to proceed