It seems this has got broken again. SearchEngine::completionSearch(WithVariants) calls SearchEngine::normalizeNamespaces which unconditionally capitalizes the input based on NS_MAIN settings. Thus PrefixSearch::defaultSearchBackend it can no longer do it's magic for namespaces where titles are not capitalised.
Description
Details
Event Timeline
@dcausse it seems you added this new code some time ago, any thoughts how to fix this?
It's very probable that I broke this feature as part of a refactoring.
normalizeNamespaces must not change the input query...
I looked at the code but it's unclear to me what could have changed this behavior.
Could you give me an example use case where this feature has been broken, I'll fix this properly and add a test so that we don't break it again. Thanks!
At http://tieteentermipankki.fi/wiki/Termipankki:Etusivu we have a modification on the skin search box that will search from multiple content namespaces. It looks like this (on the right side are the namespace names):
In our configuration, NS_MAIN has no special configuration, but the other namespaces have $wgCapitalLinkOverrides[ NS_... ] = false;.
I traced it to this line: https://github.com/wikimedia/mediawiki/blob/REL1_31/includes/search/SearchEngine.php#L446
Now I realise that the code in master is different again, and I have not tested whether this issue is fixed after the REL1_31
I did more tests and it seems it is working okay in REL1_32. Is there any simple fix that could be backported to REL1_31? Otherwise I need to wait for a stable release from REL1_32 and have it pass testing.
Oh I see, I was looking at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/444864 for a possible culprit but looks like it might fix the issue you see here. Backporting this one seems hard as it has dependent patches in CirrusSearch, I'll try to trace this down to an earlier patch to see if we can apply a quick fix.
I'll add tests for this anyways so that it won't break again.
Change 471958 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/core@master] Add test for completionSearch with wgCapitalLinkOverrides
Change 471969 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/core@REL1_32] Add test for completionSearch with wgCapitalLinkOverrides
Change 471978 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/core@REL1_31] Completion search should not change the search query
Change 471979 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/core@REL1_31] Add test for completionSearch with wgCapitalLinkOverrides
Change 471958 merged by jenkins-bot:
[mediawiki/core@master] Add test for completionSearch with wgCapitalLinkOverrides
Change 471969 merged by jenkins-bot:
[mediawiki/core@REL1_32] Add test for completionSearch with wgCapitalLinkOverrides
Change 471978 merged by jenkins-bot:
[mediawiki/core@REL1_31] Completion search should not change the search query
Change 471979 merged by jenkins-bot:
[mediawiki/core@REL1_31] Add test for completionSearch with wgCapitalLinkOverrides