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

Forms and caches connection to Elasticsearch as well as client objects that contain connection information like \Elastica\Index and \Elastica\Type. More...

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

Public Member Functions

 __construct (SearchConfig $config, $cluster=null)
 
 __sleep ()
 
 getClusterName ()
 
 getSettings ()
 
 getServerList ()
 
 getMaxConnectionAttempts ()
 How many times can we attempt to connect per host?
 
 getArchiveIndex ( $name)
 Fetch the Elastica Index for archive.
 
 getAllIndexSuffixes ( $documentType=self::PAGE_DOC_TYPE)
 Get all index types we support, content, general, plus custom ones.
 
 extractIndexSuffix ( $name)
 
 getIndexSuffixForNamespace ( $namespace)
 Get the index suffix for a given namespace.
 
 pickIndexTypeForNamespaces (array $namespaces=null)
 
 pickIndexSuffixForNamespaces (array $namespaces=null)
 
 getAllIndexSuffixesForNamespaces ( $namespaces=null)
 
 destroyClient ()
 
 getConfig ()
 

Static Public Member Functions

static getPool (SearchConfig $config, $cluster=null)
 
static clearPool ()
 Pool state must be cleared when forking.
 
static getClusterConnections (array $clusters, SearchConfig $config)
 

Public Attributes

const CONTENT_INDEX_SUFFIX = 'content'
 Suffix of the index that holds content articles.
 
const GENERAL_INDEX_SUFFIX = 'general'
 Suffix of the index that holds non-content articles.
 
const TITLE_SUGGEST_INDEX_SUFFIX = 'titlesuggest'
 Suffix of the index that hosts content title suggestions.
 
const ARCHIVE_INDEX_SUFFIX = 'archive'
 Suffix of the index that hosts archive data.
 
const PAGE_DOC_TYPE = 'page'
 Name of the page document type.
 
const TITLE_SUGGEST_DOC_TYPE = 'titlesuggest'
 Name of the title suggest document type.
 
const ARCHIVE_DOC_TYPE = 'archive'
 Name of the archive document type.
 

Protected Attributes

 $config
 
 $cluster
 

Detailed Description

Forms and caches connection to Elasticsearch as well as client objects that contain connection information like \Elastica\Index and \Elastica\Type.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Connection::__construct ( SearchConfig $config,
$cluster = null )
Parameters
SearchConfig$config
string | null$clusterName of cluster to use, or null for the default cluster.

Member Function Documentation

◆ __sleep()

CirrusSearch\Connection::__sleep ( )
Returns
never

◆ clearPool()

static CirrusSearch\Connection::clearPool ( )
static

Pool state must be cleared when forking.

Also useful in tests.

◆ extractIndexSuffix()

CirrusSearch\Connection::extractIndexSuffix ( $name)
Parameters
string$name
Returns
string
Exceptions
Exception

◆ getAllIndexSuffixes()

CirrusSearch\Connection::getAllIndexSuffixes ( $documentType = self::PAGE_DOC_TYPE)

Get all index types we support, content, general, plus custom ones.

Parameters
string | null$documentTypethe document type name the index must support to be returned can be self::PAGE_DOC_TYPE for content and general indices but also self::ARCHIVE_DOC_TYPE for the archive index. Defaults to Connection::PAGE_DOC_TYPE. set to null to return all known index types (only suited for maintenance tasks, not for read/write operations).
Returns
string[]

◆ getAllIndexSuffixesForNamespaces()

CirrusSearch\Connection::getAllIndexSuffixesForNamespaces ( $namespaces = null)
Parameters
int[] | null$namespacesList of namespaces to check
Returns
string[] the list of all index suffixes mathing the namespaces

◆ getArchiveIndex()

CirrusSearch\Connection::getArchiveIndex ( $name)

Fetch the Elastica Index for archive.

Parameters
mixed$namebasename of index
Returns
\Elastica\Index

◆ getClusterConnections()

static CirrusSearch\Connection::getClusterConnections ( array $clusters,
SearchConfig $config )
static
Parameters
string[]$clustersarray of cluster names
SearchConfig$configthe search config
Returns
Connection[] array of connection indexed by cluster name

◆ getClusterName()

CirrusSearch\Connection::getClusterName ( )
Returns
string

◆ getConfig()

CirrusSearch\Connection::getConfig ( )
Returns
SearchConfig

◆ getIndexSuffixForNamespace()

CirrusSearch\Connection::getIndexSuffixForNamespace ( $namespace)

Get the index suffix for a given namespace.

Parameters
int$namespaceA namespace id
Returns
string

◆ getMaxConnectionAttempts()

CirrusSearch\Connection::getMaxConnectionAttempts ( )

How many times can we attempt to connect per host?

Returns
int

◆ getPool()

static CirrusSearch\Connection::getPool ( SearchConfig $config,
$cluster = null )
static
Parameters
SearchConfig$config
string | null$cluster
Returns
Connection

◆ getServerList()

CirrusSearch\Connection::getServerList ( )
Returns
string[]|array[] Either a list of hostnames, for default connection configuration or an array of arrays giving full connection specifications.

◆ getSettings()

CirrusSearch\Connection::getSettings ( )
Returns
ClusterSettings

◆ pickIndexSuffixForNamespaces()

CirrusSearch\Connection::pickIndexSuffixForNamespaces ( array $namespaces = null)
Parameters
int[] | null$namespacesList of namespaces to check
Returns
string|false The suffix to use (e.g. content or general) to query the namespaces, or false if all need to be queried.

◆ pickIndexTypeForNamespaces()

CirrusSearch\Connection::pickIndexTypeForNamespaces ( array $namespaces = null)
Parameters
int[] | null$namespacesList of namespaces to check
Returns
string|false The suffix to use (e.g. content or general) to query the namespaces, or false if both need to be queried.
Deprecated
1.38 Use self::pickIndexSuffixForNamespaces

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