Execute
composer require bluespice/interwikisearch dev-REL1_31
within MediaWiki root or add bluespice/interwikisearch
to the composer.json
file of your project
Add
wfLoadExtension( 'BlueSpiceInterwikiSearch' );
to your LocalSettings.php
or the appropriate settings.d/
file.
$bsgInterwikiSearchSearchInOtherWikis = true|false
- enable/disable Interwiki search$bsgInterwikiSearchSilentOnError = true|false
- control whether failure to retrieve results from _target wiki will be shown to the user. Errors will be hidden if se to true
. This global setting can be overriden for individual _targets by specifying silent-on-erros
in _target configuration.$bsgInterwikiSearchSources
- _target specification. See next chapter_targets are configured in $bsgInterwikiSearchSources
global variable. There are several way of configuring this variable from easier and less flexible to more complex and more flexible.
Just specifying display name and base URL, all properties are generated from these values
$bsgInterwikiSearchSources = [ 'My Wiki' => 'http://my-wiki' ]
Specifying base URL and additional properties. All other necessary URLs will be generated automatically, based on base URL
$bsgInterwikiSearchSources = [ 'wiki1' => [ 'base' => 'http://my-wiki', 'name' => 'My test wiki', 'silent-on-errors' => true, 'public-wiki' => true, 'same-domain' => true ] ]
Full specification, should mainly be used when all necessary URLs differ and cannot be created from a single base URL
$bsgInterwikiSearchSources = [ 'wiki1' => [ 'api-endpoint' => 'http://my-wiki/api.php', 'search-on-wiki-url' => 'http://my-wiki/index.php?title=Special:SearchCenter&q=$1', 'name' => 'My test wiki', 'silent-on-errors' => true 'public-wiki' => true, 'same-domain' => true ] ]
base
Base URL of the _target wiki. Based on this value, other URLs will be generated. For URL http://mydomain/wiki/index.php
base URL would be http://mydomain
. Do not use if api-endpoint
or search-on-wiki-url
are set.api-endpoint
Full URL of the _target wiki's API endpoint. Use only when base
is not setsearch-on-wiki-url
Full URL of the _target wiki's Special:SearchCenter page. Use only when base
is not setname
Display name of the _target wiki that will be shown in the UIsilent-on-error
If true, _targets that report an error will be skipped, and won't show up in the UI at allpublic-wiki
Set to true if wiki is not read-locked and can be accessed without logging in. Defaults to false
.same-domain
Set to true if _target wiki is on the same base domain as the wiki you are searching from. Should be set only when public-wiki
is not set or set to false.!!! Not required if _target wikis are on the same base domain as the wiki search is executed from !!!
Wikis that are publicly available (non-logged users can read) and that have public-wiki = true
set in its _target configuration, can be searched without any further configurations.
However, searching restricted wikis is a bit more difficult. There are two criteria that need to be met in order for restricted wiki to be searchable:
User must have an active session to the _target wiki in browser where search is being done
If user wants to search a restricted wikis, without logging into that wiki first, error will be shown prompting user to log in, after which search can be continued. This does not apply to Kerberos (or similar network-based authentication, as the login process will be done automatically on first request).
_target wiki must accept request from source wiki (CORS). Fortunatelly, MediaWiki offers a mechanism to allow specifying allowed domains. If we have Wiki1 at http://wiki.on.domainone.com
and Wiki2 at http://wiki.on.domaintwo.com
, and we want to setup Wiki1 to search Wiki2, we need to add following configuration to Wiki2 (_target):
$wgCrossSiteAJAXdomains = [ 'wiki.on.domainone.com' ]
If Wiki2 is searchable from multiple sources, add every one into this variable. If multiple sources are all subdomains of the same main domain, this setting can look like:
$wgCrossSiteAJAXdomains = [ '*.mydomain.com' ]