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

Configuration class encapsulating Searcher environment. More...

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

Public Member Functions

 __construct (SearchProfileServiceFactoryFactory $searchProfileServiceFactoryFactory=null)
 Create new search config for the current wiki.
 
 getClusterAssignment ()
 
 clearCachesForTesting ()
 Reset any cached state so testing can ensures changes to global state are reflected here.
 
 isLocalWiki ()
 
 getHostWikiConfig ()
 
 has ( $name)
 
 get ( $name)
 
 getWikiId ()
 Return configured Wiki ID.
 
 makeId ( $pageId)
 
 makePageId ( $docId)
 Convert an elasticsearch document id back into a mediawiki page id.
 
 getUserLanguage ()
 Get user's language.
 
 getElement ( $configName,... $path)
 Get chain of elements from config array.
 
 isCrossProjectSearchEnabled ()
 
 isCrossLanguageSearchEnabled ()
 
 isCompletionSuggesterEnabled ()
 

Static Public Member Functions

static newFromGlobals ()
 Produce new configuration from globals.
 
static getNonCirrusConfigVarNames ()
 for unit tests purpose only
 

Public Attributes

const INDEX_BASE_NAME = 'CirrusSearchIndexBaseName'
 
const WIKI_ID_MAGIC_WORD = '__wikiid__'
 

Protected Member Functions

 setSource (Config $source)
 For Unit tests.
 

Detailed Description

Configuration class encapsulating Searcher environment.

This config class can import settings from the environment globals, or from specific wiki configuration.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\SearchConfig::__construct ( SearchProfileServiceFactoryFactory $searchProfileServiceFactoryFactory = null)

Create new search config for the current wiki.

Parameters
SearchProfileServiceFactoryFactory | null$searchProfileServiceFactoryFactory

Member Function Documentation

◆ clearCachesForTesting()

CirrusSearch\SearchConfig::clearCachesForTesting ( )

Reset any cached state so testing can ensures changes to global state are reflected here.

Only public for use from phpunit.

◆ get()

CirrusSearch\SearchConfig::get ( $name)
Parameters
string$name
Returns
mixed

◆ getElement()

CirrusSearch\SearchConfig::getElement ( $configName,
$path )

Get chain of elements from config array.

Parameters
string$configName
string...$path list of path elements
Returns
mixed Returns value or null if not present

◆ getHostWikiConfig()

CirrusSearch\SearchConfig::getHostWikiConfig ( )
Returns
SearchConfig Configuration of the host wiki.

Reimplemented in CirrusSearch\HashSearchConfig.

◆ getNonCirrusConfigVarNames()

static CirrusSearch\SearchConfig::getNonCirrusConfigVarNames ( )
static

for unit tests purpose only

Returns
string[] list of "non-cirrus" var names

◆ getUserLanguage()

CirrusSearch\SearchConfig::getUserLanguage ( )

Get user's language.

Returns
string User's language code

◆ getWikiId()

CirrusSearch\SearchConfig::getWikiId ( )

Return configured Wiki ID.

Returns
string

Reimplemented in CirrusSearch\HashSearchConfig.

◆ has()

CirrusSearch\SearchConfig::has ( $name)
Parameters
string$name
Returns
bool

◆ isCompletionSuggesterEnabled()

CirrusSearch\SearchConfig::isCompletionSuggesterEnabled ( )
Returns
bool true if the completion suggester is enabled

◆ isCrossLanguageSearchEnabled()

CirrusSearch\SearchConfig::isCrossLanguageSearchEnabled ( )
Returns
bool if cross language (same project) is enabled

◆ isCrossProjectSearchEnabled()

CirrusSearch\SearchConfig::isCrossProjectSearchEnabled ( )
Returns
bool if cross project (same language) is enabled

◆ isLocalWiki()

CirrusSearch\SearchConfig::isLocalWiki ( )
Returns
bool true if this config was built for this wiki.

Reimplemented in CirrusSearch\HashSearchConfig.

◆ makeId()

CirrusSearch\SearchConfig::makeId ( $pageId)
Todo
The indices have to be rebuilt with new id's and we have to know when generating queries if new style id's are being used, or old style. It could plausibly be done with the metastore index, but that seems like overkill because the knowledge is only necessary during transition, and not post-transition. Additionally this function would then need to know the name of the index being queried, and that isn't always known when building.
Parameters
string | int$pageId
Returns
string

◆ makePageId()

CirrusSearch\SearchConfig::makePageId ( $docId)

Convert an elasticsearch document id back into a mediawiki page id.

Parameters
string$docIdElasticsearch document id
Returns
int Related mediawiki page id
Exceptions

Exception

◆ newFromGlobals()

static CirrusSearch\SearchConfig::newFromGlobals ( )
static

Produce new configuration from globals.

Returns
SearchConfig

◆ setSource()

CirrusSearch\SearchConfig::setSource ( Config $source)
protected

For Unit tests.

Parameters
Config$sourceConfig override source

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