aboutsummaryrefslogtreecommitdiffstats
path: root/includes/search/SearchEngineConfig.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/search/SearchEngineConfig.php')
-rw-r--r--includes/search/SearchEngineConfig.php37
1 files changed, 36 insertions, 1 deletions
diff --git a/includes/search/SearchEngineConfig.php b/includes/search/SearchEngineConfig.php
index d79028c7b997..507006288a81 100644
--- a/includes/search/SearchEngineConfig.php
+++ b/includes/search/SearchEngineConfig.php
@@ -20,9 +20,20 @@ class SearchEngineConfig {
*/
private $language;
- public function __construct( Config $config, Language $lang ) {
+ /**
+ * Search Engine Mappings
+ *
+ * Key is the canonical name (used in $wgSearchType and $wgSearchTypeAlternatives).
+ * Value is a specification for ObjectFactory.
+ *
+ * @var array
+ */
+ private $engineMappings;
+
+ public function __construct( Config $config, Language $lang, array $mappings ) {
$this->config = $config;
$this->language = $lang;
+ $this->engineMappings = $mappings;
}
/**
@@ -100,6 +111,30 @@ class SearchEngineConfig {
}
/**
+ * Returns the mappings between canonical search name and underlying PHP class
+ *
+ * Key is the canonical name (used in $wgSearchType and $wgSearchTypeAlternatives).
+ * Value is a specification for ObjectFactory.
+ *
+ * For example to be able to use 'foobarsearch' in $wgSearchType and
+ * $wgSearchTypeAlternatives but the PHP class for 'foobarsearch'
+ * is 'MediaWiki\Extensions\FoobarSearch\FoobarSearch' set:
+ *
+ * @par extension.json Example:
+ * @code
+ * 'SearchMappings': {
+ * 'foobarsearch': { 'class': 'MediaWiki\\Extensions\\FoobarSearch\\FoobarSearch' }
+ * }
+ * @endcode
+ *
+ * @since 1.35
+ * @return array
+ */
+ public function getSearchMappings() {
+ return $this->engineMappings;
+ }
+
+ /**
* Get a list of namespace names useful for showing in tooltips
* and preferences.
*