Manual:$wgNamespacesToBeSearchedDefault

Details
The variable holds an array of namespaces, indicating which namespaces are enabled for searching by default. The array is indexed by the namespace ID, and each index holds either False (don't search) or True (search this namespace).

Note that changing these values in LocalSettings.php only affects newly created and anonymous users - it does not change the settings for existing users. To also update the settings for current users who have not yet changed their search preferences, modify the User.php file as well (see below).

Default value (1.5.0 and above)
Change "false" to "true" to set the namespaces new users will search.

userOptions.php MediaWiki maintenance script
Use the userOptions.php script provided with MediaWiki to change the default namespaces for existing users (or see how many are differing from your new defaults). For example, to search user pages: php userOptions.php --nowarn --quiet searchNs2 --old 0 --new 1

For other namespaces, just replace searchNs# with the namespace number like one of those listed on the Manual:Namespace page.


 * 1) php userOptions.php

This script pass through all users and change one of their options. The new option is NOT validated.

Usage: php userOptions.php --list php userOptions.php --usage php userOptions.php [options]Â --old --new

Switchs: --list : list available user options and their default value

--usage : report statistics about an option

--old : the value to look for --new : new value to update users with

Options: --nowarn: hides the 5 seconds warning --quiet : do not print what is happening --dry  : do not save user settings back to database

Old versions
The variable holds an array of namespaces, numbered from -1 (Special:) and not including -2 (direct-linked media), indicating which namespaces are enabled for searching by default. The array is indexed by the numeric namespace ID, and each index holds either 0 (don't search) or 1 (search this namespace).

Default value (prior to 1.5.0)
The NS_ constants weren't used (possibly because they weren't defined) so numeric values were used instead:

Default value (prior to 1.4.5)
Prior to 1.4.5, namespaces 9 and 11 were also searched.

Another method
This is an example of what to edit if nothing else works.