Page MenuHomePhabricator

New search widget API doesn't work in "Special:" and "File:" namespace
Closed, ResolvedPublic

Assigned To
Authored By
Golmore
Mar 13 2021, 10:37 AM
Referenced Files
F34162406: Screen Shot 2021-03-15 at 2.59.52 PM.png
Mar 15 2021, 10:00 PM
F34162404: Screen Shot 2021-03-15 at 2.59.29 PM.png
Mar 15 2021, 10:00 PM
F34162402: Screen Shot 2021-03-15 at 2.59.17 PM.png
Mar 15 2021, 10:00 PM
Tokens
"Pterodactyl" token, awarded by Ciencia_Al_Poder."Like" token, awarded by Samwilson."Heartbreak" token, awarded by Lens0021."Mountain of Wealth" token, awarded by Quiddity."Like" token, awarded by Frostly."Like" token, awarded by IKhitron."Like" token, awarded by Pcoombe."Like" token, awarded by Amire80.

Description

The new search widget doesn't display any results in namespaces "Special:" and "File:".

Previously it supported searching across titles by prefix e.g. "File:" and "Special:Search" would allow access to the special page.

Before

Screen Shot 2021-03-15 at 2.59.52 PM.png (400×1 px, 69 KB)

Now

Screen Shot 2021-03-15 at 2.59.17 PM.png (258×1 px, 24 KB)

Screen Shot 2021-03-15 at 2.59.29 PM.png (274×1 px, 34 KB)

Developer notes

The API should be able to handle these use cases.

Event Timeline

Jdlrobson renamed this task from New search widget doesn't work in "Special:" and "File:" namespace to New search widget API doesn't work in "Special:" and "File:" namespace.Mar 15 2021, 10:00 PM
Jdlrobson assigned this task to ovasileva.
Jdlrobson updated the task description. (Show Details)
Jdlrobson subscribed.

another task to bring up with the platform team about the new search API

My first guess as to what may be the cause is that in the SearchHandler class, SearchHandler:: createSearchEngine() is using defaultNamespaces() to set the searchable namespaces. I see another method that exists called searchableNamespaces() that might be the correct set of namespaces to use.

Hasn't been tested or anything but might be part of the solution after a quick glance?

Hasn't been tested or anything but might be part of the solution after a quick glance?

I think the key issue here is that the namespace prefix must be detected as such, resolved to a namespace ID, and the search engine has to be instructed to search in that namespace, and that namespace only. If no namespace is detected, it should search in the default namespaces.

The expected behavior seems to be: "User Anchovies" does not find any user, because it's search in the default namespaces. "User:Anchovies" returns results only from the User namespace. At least, that's how Special:Search and the old search box behave.

I suppose TitleParser could be used for namespace detection.

This seems to be fixed on English Wikipedia now. What happened?

Appears it does work in File namespace, both for local and Commons, but still does not work for Special pages. At least for me, on any wiki site.

this ticket should probably have been tagged in this patch https://gerrit.wikimedia.org/r/c/mediawiki/core/+/762945/
The "Special:" namespace works if you add the colon i believe.

Resolved in this patch. This should be tagged in the description, but my authentication failed for Gerrit so I can't do it right now.

this ticket should probably have been tagged in this patch https://gerrit.wikimedia.org/r/c/mediawiki/core/+/762945/
The "Special:" namespace works if you add the colon i believe.

I think this is on-par with other namespace autosuggesting such as with the Template: namespace.