This file provides documentation for AdvancedSearch configuration variables.
It should be updated each time a new configuration parameter is added or changed.
$wgAdvancedSearchNamespacePresets
AdvancedSearch supports namespace presets, groups of namespaces that are offered for batch selection via dedicated checkboxes. By default the following presets are offered: defaultNamespaces, discussion, generalHelp, and all.
Which namespaces are contained in a preset can be configured
namespaces
key containing an array of namespace ids,provider
key containing a reference to a JavaScript function returning the aforementioned namespace id array. The available provider functions are implemented in NamespacePresetProviders.You can use $wgAdvancedSearchNamespacePresets
to modify the default configuration or add your own presets.
// in your LocalSettings.php wfLoadExtension( 'AdvancedSearch' ); $wgAdvancedSearchNamespacePresets = [ 'my-custom-preset' => [ 'enabled' => true, // indication that this preset should be shown to the user 'namespaces' => [ '1', '11' ], // list of namespaces to include in this preset 'label' => 'my-custom-preset-label-id' // id of the translation to use to label the preset checkbox ], ];
// in your LocalSettings.php wfLoadExtension( 'AdvancedSearch' ); $wgAdvancedSearchNamespacePresets = [ 'generalHelp' => [ 'enabled' => false, ], ];
If your wiki needs to determine namespaces at runtime or if you write an extension that can provide a dynamic namespace preset, you can use the provider
setting instead of the namespaces
setting.
// in your LocalSettings.php wfLoadExtension( 'AdvancedSearch' ); $wgAdvancedSearchNamespacePresets = [ 'my-custom-preset' => [ 'enabled' => true, // indication that this preset should be shown to the user 'provider' => 'custom-talk', // unique provider id 'label' => 'my-custom-preset-label-id' // message id of the translation to use as a label for the preset checkbox ] ];
// in the Javascript initialization code of your extension or in the common.js of your wiki function customTalkNamespaceProvider( namespaceIds ) { $.grep( namespaceIds, function ( id ) { var numericId = Number( id ); return numericId > 100 && numericId % 2; } ); } mw.hook( 'advancedSearch.initNamespacePresetProviders' ).add( function( namespaceProviders ) { // use unique provider name from PHP config as key namespaceProviders[ 'custom-talk' ] = customTalkNamespaceProvider; } );
The provider function customTalkNamespaceProvider
will get an array of all supported namespaces ids. If it returns unsupported namespace ids, the preset will not be shown. If the provider function returns an empty array, the preset is not shown. This is for creating presets that depend on the existence of certain namespaces.
$wgAdvancedSearchDeepcatEnabled
AdvancedSearch acts as a remote for CirrusSearch features. An advanced, optional CirrusSearch feature is deepcat:
, which allows to search in subcategories. By default, AdvancedSearch assumes this is available. It needs to be disabled on wikis that can't or don't want to set up the required SPARQL service.
// in your LocalSettings.php $wgAdvancedSearchDeepcatEnabled = false; // disable deepcat: in favor of incategory: