CirrusSearch
Elasticsearch-powered search for MediaWiki
|
Handles non-maintenance write operations to the elastic search cluster. More...
Public Member Functions | |
__construct (Connection $conn, SearchConfig $config) | |
sendUpdateWeightedTags (string $indexSuffix, array $docIds, string $tagField, string $tagPrefix, $tagNames=null, array $tagWeights=null, int $batchSize=30) | |
sendResetWeightedTags (string $indexSuffix, array $docIds, string $tagField, string $tagPrefix, int $batchSize=30) | |
sendData ( $indexSuffix, array $documents) | |
sendDeletes ( $docIds, $indexSuffix=null) | |
Send delete requests to Elasticsearch. | |
sendOtherIndexUpdates ( $localSite, $indexName, array $otherActions, $batchSize=30) | |
docToSuperDetectNoopScript (\Elastica\Document $doc) | |
Converts a document into a call to super_detect_noop from the wikimedia-extra plugin. | |
Public Member Functions inherited from CirrusSearch\ElasticsearchIntermediary | |
start (RequestLog $log) | |
Mark the start of a request to Elasticsearch. | |
success ( $result=null, Connection $connection=null) | |
Log a successful request and return the provided result in a good Status. | |
successViaCache (RequestLog $log) | |
Log a successful request when the response comes from a cache outside elasticsearch. | |
failure (ExceptionInterface $exception=null, Connection $connection=null) | |
Log a failure and return an appropriate status. | |
getSearchMetrics () | |
Get the search metrics we have. | |
Protected Member Functions | |
decideRequiredSetAction (Title $title) | |
Decide what action is required to the other index to make it up to data with the current wiki state. | |
bulkResponseExceptionIsJustDocumentMissing (ResponseException $exception, $logCallback=null) | |
Check if $exception is a bulk response exception that just contains document is missing failures. | |
newLog ( $description, $queryType, array $extra=[]) | |
Protected Member Functions inherited from CirrusSearch\ElasticsearchIntermediary | |
__construct (Connection $connection, UserIdentity $user=null, $slowSeconds=null, $extraBackendLatency=0) | |
startNewLog ( $description, $queryType, array $extra=[]) | |
getTimeout ( $searchType='default') | |
getClientTimeout ( $searchType='default') | |
appendMetrics (SearchMetricsProvider $provider) | |
runMSearch (Search $search, RequestLog $log, Connection $connection=null, callable $resultsTransformer=null) | |
Additional Inherited Members | |
Static Public Member Functions inherited from CirrusSearch\ElasticsearchIntermediary | |
static | setResultPages (array $matches) |
This is set externally because we don't have complete control, from the SearchEngine interface, of what is actually sent to the user. | |
static | getQueryTypesUsed () |
Report the types of queries that were issued within the current request. | |
static | hasQueryLogs () |
static | appendLastLogPayload ( $key, $value) |
static | isMSearchResultSetOK (MultiResultSet $multiResultSet) |
check validity of the multisearch response | |
Protected Attributes inherited from CirrusSearch\ElasticsearchIntermediary | |
$connection | |
$user | |
$currentRequestLog = null | |
Static Protected Attributes inherited from CirrusSearch\ElasticsearchIntermediary | |
static | $requestLogger |
Handles non-maintenance write operations to the elastic search cluster.
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
CirrusSearch\DataSender::__construct | ( | Connection | $conn, |
SearchConfig | $config ) |
Connection | $conn | |
SearchConfig | $config |
|
protected |
Check if $exception is a bulk response exception that just contains document is missing failures.
ResponseException | $exception | exception to check |
callable | null | $logCallback | Callback in which to do some logging. Callback will be passed the id of the missing document. |
|
protected |
Decide what action is required to the other index to make it up to data with the current wiki state.
This will always check against the master database.
Title | $title | The title to decide the action for |
|
protected |
string | $description | |
string | $queryType | |
string[] | $extra |
Reimplemented from CirrusSearch\ElasticsearchIntermediary.
CirrusSearch\DataSender::sendData | ( | $indexSuffix, | |
array | $documents ) |
string | $indexSuffix | suffix of index to which to send $documents |
\Elastica\Document[] | $documents | documents to send |
Transform the finalized documents into noop scripts if possible to reduce update load.
CirrusSearch\DataSender::sendDeletes | ( | $docIds, | |
$indexSuffix = null ) |
Send delete requests to Elasticsearch.
string[] | $docIds | elasticsearch document ids to delete |
string | null | $indexSuffix | index from which to delete. null means all. |
CirrusSearch\DataSender::sendOtherIndexUpdates | ( | $localSite, | |
$indexName, | |||
array | $otherActions, | ||
$batchSize = 30 ) |
string | $localSite | The wikiId to add/remove from local_sites_with_dupe |
string | $indexName | The name of the index to perform updates to |
array[] | $otherActions | A list of arrays each containing the id within elasticsearch ('docId') and the article namespace ('ns') and DB key ('dbKey') at the within $localSite |
int | $batchSize | number of docs to update in a single bulk |
CirrusSearch\DataSender::sendResetWeightedTags | ( | string | $indexSuffix, |
array | $docIds, | ||
string | $tagField, | ||
string | $tagPrefix, | ||
int | $batchSize = 30 ) |
string | $indexSuffix | |
string[] | $docIds | |
string | $tagField | |
string | $tagPrefix | |
int | $batchSize |
CirrusSearch\DataSender::sendUpdateWeightedTags | ( | string | $indexSuffix, |
array | $docIds, | ||
string | $tagField, | ||
string | $tagPrefix, | ||
$tagNames = null, | |||
array | $tagWeights = null, | ||
int | $batchSize = 30 ) |
string | $indexSuffix | |
string[] | $docIds | |
string | $tagField | |
string | $tagPrefix | |
string | string[] | null | $tagNames | A tag name or list of tag names. Each tag will be set for each document ID. Omit for tags which are fully defined by their prefix. |
int[] | int[][] | null | $tagWeights | An optional map of docid => weight. When $tagName is null, the weight is an integer. When $tagName is not null, the weight is itself a tagname => int map. Weights are between 1-1000, and can be omitted (in which case no update will be sent for the corresponding docid/tag combination). |
int | $batchSize |