The prefix keyword allows to change the list of namespaces in the SearchContext.
If the list of searched namespaces could be fixed from the beginning this would greatly simplify the refactoring started in T185108.
I propose to change how prefix works by moving the namespace filter inside the query it builds.
While building the query if the prefix detects some incompatible settings, e.g. the namespace requested are set to NS_MAIN but the query asks for prefix:Help:Page I suggest that we emit a deprecation warning asking the user to change their query by prefixing it with all:.
UPDATE: this change caused many search forms to stop working properly. The warning message was not an appropriate solution. We will figure out another solution to move this forward.
The patch to revert this change will be deployed to production wikis on Monday May 14 at 15:00 CEST.
Deployment of this patch currently blocked by T194632.
The patch to revert has finally been deployed by @Reedy (thanks!!)