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

Filter unused and duplicate entries from elasticsearch index configuration. More...

Public Member Functions

 findUsedAnalyzersInMappings (array $mappings)
 
 pushAnalyzerAliasesIntoMappings (array $mappings, $aliases)
 
 filterUnusedAnalysisChain ( $analysis, Set $usedAnalyzers)
 
 deduplicateAnalysisConfig (array $analysis)
 Remove duplicate analysis chain elements and report aliases that need to be applied to mapping configuration.
 
 filterAnalysis (array $analysis, array $mappings, $deduplicate=false, array $protected=[])
 Shrink the size of elasticsearch index configuration.
 

Detailed Description

Filter unused and duplicate entries from elasticsearch index configuration.

Member Function Documentation

◆ deduplicateAnalysisConfig()

CirrusSearch\Maintenance\AnalysisFilter::deduplicateAnalysisConfig ( array $analysis)

Remove duplicate analysis chain elements and report aliases that need to be applied to mapping configuration.

This is necessary for indices such as wikibase that eagerly create analysis chains for many languages. Quite a few languages result in the same elements and this deduplication can remove a large fraction of the configuration.

Parameters
array$analysisThe index.analysis field of elasticsearch index settings
Returns
string[] map from old analyzer name to new analyzer name.

◆ filterAnalysis()

CirrusSearch\Maintenance\AnalysisFilter::filterAnalysis ( array $analysis,
array $mappings,
$deduplicate = false,
array $protected = [] )

Shrink the size of elasticsearch index configuration.

Removes analysis chain elements that are defined but never referenced from the mappings. Optionally deduplicates elements of the analysis chain.

Parameters
array$analysisElasticsearch index analysis configuration
array$mappingsElasticsearch index mapping configuration
bool$deduplicateWhen true deduplicate the analysis chain
string[]$protectedlist of named analyzers that should not be removed.
Returns
array [$settings, $mappings]

◆ filterUnusedAnalysisChain()

CirrusSearch\Maintenance\AnalysisFilter::filterUnusedAnalysisChain ( $analysis,
Set $usedAnalyzers )
Parameters
array$analysisThe index.analysis field of elasticsearch index settings
Set$usedAnalyzersSet of analyzers to keep configurations for
Returns
array The $analysis array filtered to only pieces needed for $usedAnalyzers

◆ findUsedAnalyzersInMappings()

CirrusSearch\Maintenance\AnalysisFilter::findUsedAnalyzersInMappings ( array $mappings)
Parameters
array[]$mappingsElasticsearch mapping configuration
Returns
Set The set of analyzer names referenced in $mappings

◆ pushAnalyzerAliasesIntoMappings()

CirrusSearch\Maintenance\AnalysisFilter::pushAnalyzerAliasesIntoMappings ( array $mappings,
$aliases )
Parameters
array[]$mappingsElasticsearch index mapping configuration
string[]$aliasesMapping from old name to new name for analyzers
Returns
array Updated index mapping configuration

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