Page MenuHomePhabricator

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

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

Now


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 added a subscriber: Jdlrobson.

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.