Author: jr534
Description:
It appears confusing to naive users that on a search as an anonymous user,
the search results page doesn't show the Main checkbox as checked (although
anonymous searches default as such), so the user may wonder what exactly is
the search space. Furthermore, why DO the default namespaces to search for
anonymous users only include Main?
The first topic:
Looking at the code, the checkboxes are outputted in
SpecialSearch::powerSearchBox and are checked for each user namespace found
in the user options (for anonymous users, there will be none).
Now if you look at SpecialSearch::showResults, the search is conducted
before the call to SpecialSearch::powerSearchBox. When that search is
conducted, a copy of the user namespaces (up to now, empty) is passed and
in SearchEngine::queryNamespaces, it is finally realized that if no user
namespaces exist, then default to the Main namespace. But since this is a
copy of the namespaces array, the change is not reflected when control
passes back to SpecialSearch:showResults and never displays (bug?).
The second topic:
When users are created, they inherit the $wgNamespacesToBeSearchedDefault
as their settings, why not allow anonymous searches to include the same?
A humble suggestion to address the two topics is to rewrite
SpecialSearch::userNamespaces as follows:
function userNamespaces( &$user ) {
global $wgNamespacesToBeSearchedDefault; if( !$user->mId ) { return array_keys( $wgNamespacesToBeSearchedDefault ); } else { ... //put the entire code currently in userNamespaces here }
}
Version: unspecified
Severity: minor
URL: http://xnoybis.ccnmtl.columbia.edu:8080/sb/jrod/clean_wiki_1_4/index.php/Special:Search?search=thesis