Page MenuHomePhabricator

Search boxes for some pages on Commons show no results due to switch from SpecialSearch to MediaSearch
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
It shows the "Images" tab by default and doesn't apply the prefix search operator.

What should have happened instead?:

  • It should show the "Categories and Pages" tab by default via allowing the default tab to be specified in the template.
  • It should apply the prefix search operator that was applied with SpecialSearch. For example, prefix=Commons:Village_pump/Archive for the first example in the list above.

The templates would need be edited to specify that.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

This is basically a feature request so that a new bug can be fixed so I'm not sure whether to file this as a bug report or feature request – given that the reason and purpose for this issue is fixing a relatively urgent problem/bug, I think bug report fits better.

Event Timeline

Aklapper renamed this task from Search boxes for meta pages on Commons don't work with MediaSearch – allow preselecting search results tab & apply prefix search operator to Search boxes for some pages on Commons show no results due to switch from SpecialSearch to MediaSearch.Jul 14 2025, 4:51 PM

I think part of the issue here belongs to MediaSearch:

That aside, it does sound like InputBox needs a way to set MediaSearch's type, perhaps searchtype=(image|audio|video|other|page)? Although, it's also a bit weird that page ("Categories and Pages") also finds File namespace pages (e.g.).

As I explained here, the button at the top of the 'Help:Contents' page of Wikimedia Commons (it is the page linked at the left in the Main menu for help) launches the search in Special:MediaSearch instead of in Special:Search too, this is a problem because in this page users are searching for text.

it does sound like InputBox needs a way to set MediaSearch's type, perhaps searchtype=(image|audio|video|other|page)?

Yes, "and some parameter(s) for the tab that should be opened which is "Images" by default)" in T378756. If one specifies pages, then as described The prefix search operator is not applied anymore so this would need fixing first before MediaSearch->Pages could be used instead of SpecialSearch for pages like Help:Contents that search through certain discussion pages with a specified prefix.

Change #1174925 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/InputBox@master] Add searchtype parameter for MediaSearch

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

Jdlrobson-WMF subscribed.

Incoming patch (and opportunity to learn more about this extension)

Solved to some extent now that specifying searchengine = Search makes search boxes use SpecialSearch. In some way that's a workaround – as described these meta page searches should also work with MediaSearch so the issue remains. In any case, that's why those example templates are working again in case somebody was wondering.

This is still not working. It is very annoying to seek for help and be redirected to the file gallery. Low priority for pages of Help is not a good idea in my opinion.

The above patch is ready for review, if anyone's got time. Then it'll be possible to specify searchtype=other (although that might not be that useful for some types of search).

Low priority for pages of Help is not a good idea in my opinion.

I agree, but I do think that there are now fewer people annoyed at not being sent to MediaSearch when they're trying to search for images. It's just the other way around to what it was before. But more inputboxen are for images (I think mostly on category pages) than for help pages.

Which search box are you talking about? Because it can be fixed by adding searchengine=Search.

I am not aware of any usage of inputbox used on a regular wikitext page where the link is intended for searching for files. The only possibly case might be gadgets.

There are quite a lot, mainly on category pages. It's sort of hard to see how many of those are using the prefix= (e.g.) or namespace= (e.g.) parameters, but it doesn't look like it's the majority.

The full implementation depends on T404955 to be implemented first

Change #1174925 merged by jenkins-bot:

[mediawiki/extensions/InputBox@master] Add searchtype parameter for MediaSearch

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

This was merged last Monday so went out on the train last week.

Using the search boxes on https://commons.wikimedia.org/wiki/Template:Administrators%27_noticeboard (and the other pages listed above) is appears to be working as expected with the bug fix.

https://commons.wikimedia.org/wiki/Special:Search?search=sculpture&prefix=Commons%3AVillage+pump%2FArchive&ns4=1&fulltext=%F0%9F%94%8D&fulltext=Search

HFan-WMF reassigned this task from HFan-WMF to Samwilson.
HFan-WMF subscribed.