Last modified: 2014-10-12 13:17:58 UTC
SimpleSearch searches only in the main namespace (namespaces=0) and ignores user/site-configured default search namespaces, as well as checked namespaces in advanced search. This works with mwsuggest.js and is implemented in function os_getNamespaces() Raised on en.wp VPT: http://en.wikipedia.org/wiki/WP:VPT#Search_bar
Also reported on [[zh:WP:UX]], and the reporter says prefixing the namespace names works for a specific namespace.
I also have the same idea.
Reassign to default per bug 37789
Is this still happening? It has since been extracted into a stand-alone extension (Extension:Vector).
Moving to mediawiki-core/interface and setting to unconfirmed as it has been changed quite a bit since 2010.
Confirmed still broken in 1.22.0rc2
Thanks for retesting!
Here's a fix since the data is right there in mw.user.options. Add this function to mediawiki.searchSuggest.js: // Get current namespaces function getNamespaces() { var state = null, namespaces = '', i = 0, limit = 1000; do { state = mw.user.options.get('searchNs'+i); switch (state) { case true: namespaces += i+'|'; case null: break; } i++; } while (state != null); if (namespaces.length > 1) { namespaces = namespaces.substring(0, namespaces.length-1); } return namespaces; } Then, on line 149, change "namespace: 0," to "namespace: getNamespaces(),". Code I am referencing: https://git.wikimedia.org/blob/mediawiki%2Fcore.git/8bb12babcd4c791c50aa53f14f68224162aaef80/resources%2Fmediawiki%2Fmediawiki.searchSuggest.js
One adjustment on the return so it always at least sends 0: // Get current namespaces function getNamespaces() { var state = null, namespaces = '', i = 0, limit = 1000; do { state = mw.user.options.get('searchNs'+i); switch (state) { case true: namespaces += i+'|'; case null: break; } i++; } while (state != null); if (namespaces.length > 1) { return namespaces.substring(0, namespaces.length-1); } return 0; }
I didn't realize how custom namespaces work so the above code wont work. Something like this should though: // Get current namespaces function getNamespaces() { var namespaces = '', options = mw.user.options.get(); for(var opt in options) { if(opt.substring(0,8) === 'searchNs') { if(options[opt] === true) { namespaces += opt.substr(8)+'|'; } } } if (namespaces.length > 1) { return namespaces.substring(0, namespaces.length-1); } else { return 0; } }
Oh yay, thanks for going through the code! You are very welcome to use Developer access https://www.mediawiki.org/wiki/Developer_access to submit this as a Git branch directly into Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial Putting your branch in Git makes it easier to review it quickly. Thanks again!
Somebody please add this to core. I was about to open a request for that.
Change 164893 had a related patch set uploaded by saper: searchSuggest.js: Pass user ns preferences to API https://gerrit.wikimedia.org/r/164893