Page MenuHomePhabricator

Should be possible to customize the search profiles.
Closed, ResolvedPublic

Description

Author: conrad.irwin

Description:
It would be nice if the namespaces available to be searched could be customised easily, either by the server-folk or the wiki's Sysops.

I envisage a $wgSearchNamespaces to deprecate $wgNamespacesToBeSearchedDefault and $wgNamespacesToBeSearchedHelp in favour of a more flexible configuration

(A Wiktionarian suggested that they'd like:

$wgSearchNamespaces = array(

'dictionary' => array( NS_MAIN ), 
'thesaurus'  => array( 110 ),
'appendices' => array( 100, 102, 106 ),
'help-project' => array( NS_HELP, NS_PROJECT ),
'everything' => SEARCH_ALL,
'custom'     => SEARCH_CUSTOM

);

Obviously, being able to remove the Multimedia option is useful for any site that uses commons for all its media; and adding options is beneficial for any site with custom namespaces)

An alternative would be a set-up like [[MediaWiki:Sidebar]] where the message can be read and parsed (and cached!) - would require less precious sysadmin time.

This might be possible using an extension to Hook into 'SpecialSearchProfiles', but it would be cleaner to fix SpecialSearch::getSearchProfiles() directly (particularly for a configuration variable).


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=38395
https://bugzilla.wikimedia.org/show_bug.cgi?id=61053

Details

Reference
bz22774

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:02 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz22774.
bzimport added a subscriber: Unknown Object (MLST).

Absolutely. This whole thing needs a facelift.

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Seb35 lowered the priority of this task from Medium to Low.Jun 27 2024, 9:39 AM
Seb35 subscribed.

This is already possible with the hook SpecialSearchProfiles instead of a config parameter or a MediaWiki:Sidebar-like alternative, so it should be clearer here what is really wanted (I’m aware the original author probably does not follow this task, so the question is to people interested to this task).

To achieve the same effect as config parameter, it is currently possible to put in LocalSettings.php something like:

$wgHooks['SpecialSearchProfiles'][] = function( &$profiles ) {
	$profiles = [
		'default' => [
			'message' => 'searchprofile-articles',
			'tooltip' => 'searchprofile-articles-tooltip',
			'namespaces' => [ NS_MAIN ],
		],
		
	];
	return true;
};

where $profiles is documented on https://www.mediawiki.org/wiki/Manual:Hooks/SpecialSearchProfiles.

TheDJ claimed this task.
TheDJ subscribed.

Possible with SpecialSearchProfiles