Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
1 / 1
CirrusSearchHookRunner
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
8
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchRegisterFullTextQueryClassifiers
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchAddQueryFeatures
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchSimilarityConfig
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchAnalysisConfig
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchMappingConfig
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchProfileService
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onCirrusSearchScoreBuilder
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace CirrusSearch;
4
5use CirrusSearch\Maintenance\AnalysisConfigBuilder;
6use CirrusSearch\Maintenance\MappingConfigBuilder;
7use CirrusSearch\Search\Rescore\BoostFunctionBuilder;
8use MediaWiki\HookContainer\HookContainer;
9
10/**
11 * @internal
12 */
13class CirrusSearchHookRunner implements
14    \CirrusSearch\Hooks\CirrusSearchRegisterFullTextQueryClassifiersHook,
15    \CirrusSearch\Hooks\CirrusSearchAddQueryFeaturesHook,
16    \CirrusSearch\Hooks\CirrusSearchSimilarityConfigHook,
17    \CirrusSearch\Hooks\CirrusSearchAnalysisConfigHook,
18    \CirrusSearch\Hooks\CirrusSearchMappingConfigHook,
19    \CirrusSearch\Hooks\CirrusSearchProfileServiceHook,
20    \CirrusSearch\Hooks\CirrusSearchScoreBuilderHook
21{
22    private HookContainer $hookContainer;
23
24    public function __construct( HookContainer $hookContainer ) {
25        $this->hookContainer = $hookContainer;
26    }
27
28    public function onCirrusSearchRegisterFullTextQueryClassifiers( Parser\ParsedQueryClassifiersRepository $repository ): void {
29        $this->hookContainer->run( 'CirrusSearchRegisterFullTextQueryClassifiers', [ $repository ] );
30    }
31
32    public function onCirrusSearchAddQueryFeatures( SearchConfig $config, array &$extraFeatures ): void {
33        $this->hookContainer->run( 'CirrusSearchAddQueryFeatures', [ $config, &$extraFeatures ] );
34    }
35
36    public function onCirrusSearchSimilarityConfig( array &$similarityConfig ): void {
37        $this->hookContainer->run( 'CirrusSearchSimilarityConfig', [ &$similarityConfig ] );
38    }
39
40    public function onCirrusSearchAnalysisConfig( array &$config, AnalysisConfigBuilder $analyisConfigBuilder ): void {
41        $this->hookContainer->run( 'CirrusSearchAnalysisConfig', [ &$config, $analyisConfigBuilder ] );
42    }
43
44    public function onCirrusSearchMappingConfig( array &$mappingConfig, MappingConfigBuilder $mappingConfigBuilder ): void {
45        $this->hookContainer->run( 'CirrusSearchMappingConfig', [ &$mappingConfig, $mappingConfigBuilder ] );
46    }
47
48    public function onCirrusSearchProfileService( Profile\SearchProfileService $service ): void {
49        $this->hookContainer->run( 'CirrusSearchProfileService', [ $service ] );
50    }
51
52    public function onCirrusSearchScoreBuilder( array $definition, Search\SearchContext $context, ?BoostFunctionBuilder &$builder ): void {
53        $this->hookContainer->run( 'CirrusSearchScoreBuilder', [ $definition, $context, &$builder ] );
54    }
55}