CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\BaseInterwikiResolver Class Reference

Base InterwikiResolver class. More...

+ Inheritance diagram for CirrusSearch\BaseInterwikiResolver:
+ Collaboration diagram for CirrusSearch\BaseInterwikiResolver:

Public Member Functions

 __construct (SearchConfig $config, MultiHttpClient $client, WANObjectCache $wanCache, InterwikiLookup $iwLookup)
 
 getSisterProjectPrefixes ()
 
 getSisterProjectConfigs ()
 
 getInterwikiPrefix ( $wikiId)
 
 getSameProjectWikiByLang ( $lang)
 
 getSameProjectConfigByLang ( $lang)
 

Protected Member Functions

 loadMatrix ()
 Load the interwiki matric information The returned array must include the following keys:
 
 minimalSearchConfig ( $wiki, array $hashConfigFlags)
 Minimal config needed to run a search on a target wiki living on the same cluster as the host wiki.
 

Protected Attributes

SearchConfig $config
 
InterwikiLookup $interwikiLookup
 
WANObjectCache $wanCache
 

Additional Inherited Members

- Public Attributes inherited from CirrusSearch\InterwikiResolver
const SERVICE = 'CirrusSearchInterwikiresolver'
 @const string service name
 

Detailed Description

Base InterwikiResolver class.

Subclasses just need to provide the full matrix array by implementing loadMatrix(), the resulting matrix will be stored by this base class.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\BaseInterwikiResolver::__construct ( SearchConfig $config,
MultiHttpClient $client,
WANObjectCache $wanCache,
InterwikiLookup $iwLookup )
Parameters
SearchConfig$config
MultiHttpClient$clienthttp client to fetch cirrus config
WANObjectCache$wanCacheCache object for caching repeated requests
InterwikiLookup$iwLookup

Reimplemented in CirrusSearch\SiteMatrixInterwikiResolver.

Member Function Documentation

◆ getInterwikiPrefix()

CirrusSearch\BaseInterwikiResolver::getInterwikiPrefix ( $wikiId)
Parameters
string$wikiId
Returns
string|null

Implements CirrusSearch\InterwikiResolver.

◆ getSameProjectConfigByLang()

CirrusSearch\BaseInterwikiResolver::getSameProjectConfigByLang ( $lang)
Parameters
string$lang
Returns
SearchConfig[] single element array: [ interwiki => SearchConfig ]

Implements CirrusSearch\InterwikiResolver.

◆ getSameProjectWikiByLang()

CirrusSearch\BaseInterwikiResolver::getSameProjectWikiByLang ( $lang)
Parameters
string$lang
Returns
string[] a two elements array [ 'prefix', 'language' ]

Implements CirrusSearch\InterwikiResolver.

◆ getSisterProjectConfigs()

CirrusSearch\BaseInterwikiResolver::getSisterProjectConfigs ( )
Returns
SearchConfig[] configs of sister project indexed by interwiki prefix

Implements CirrusSearch\InterwikiResolver.

◆ getSisterProjectPrefixes()

CirrusSearch\BaseInterwikiResolver::getSisterProjectPrefixes ( )
Returns
string[]

Implements CirrusSearch\InterwikiResolver.

◆ loadMatrix()

CirrusSearch\BaseInterwikiResolver::loadMatrix ( )
abstractprotected

Load the interwiki matric information The returned array must include the following keys:

  • sister_projects: an array with the list of sister wikis indexed by interwiki prefix
  • cross_language: an array with the list of wikis running the same project/site indexed by interwiki prefix
  • language_map: an array with the list of interwiki prefixes where where the language code of the wiki does not match the prefix
  • prefixes_by_wiki: an array with the list of interwiki indexed by wikiID

The result of this method is stored in the current InterwikiResolver instance so it can be called only once per request.

return array[]

Reimplemented in CirrusSearch\CirrusConfigInterwikiResolver, and CirrusSearch\SiteMatrixInterwikiResolver.

◆ minimalSearchConfig()

CirrusSearch\BaseInterwikiResolver::minimalSearchConfig ( $wiki,
array $hashConfigFlags )
protected

Minimal config needed to run a search on a target wiki living on the same cluster as the host wiki.

Parameters
string$wiki
string[]$hashConfigFlagsconstructor flags for HashSearchConfig
Returns
SearchConfig

The documentation for this class was generated from the following file: