Allow overriding the search pattern highlighting for Wikibase

Use a php hook to override the highlightQuery attribute.
This allows us to turn off search higlighting for all
wikibase repo instances.

Bug: T327510
Change-Id: I0ef27da9cf4ac66151d1a391e9f606100097d7f0
This commit is contained in:
Noa wmde 2023-06-02 12:56:22 +02:00 committed by Jdlrobson
parent 274c97acb5
commit 2c96f9b3d7

View file

@ -96,11 +96,17 @@ class Hooks implements
RL\Context $context,
Config $config
): array {
$result = $config->get( 'VectorWvuiSearchOptions' );
$result['highlightQuery'] =
VectorServices::getLanguageService()->canWordsBeSplitSafely( $context->getLanguage() );
$vectorSearchConfig = [
'highlightQuery' =>
VectorServices::getLanguageService()->canWordsBeSplitSafely( $context->getLanguage() )
];
return $result;
MediaWikiServices::getInstance()->getHookContainer()->run(
'VectorSearchResourceLoaderConfig',
[ &$vectorSearchConfig ]
);
return array_merge( $config->get( 'VectorWvuiSearchOptions' ), $vectorSearchConfig );
}
/**