jenkins-bot has submitted this change and it was merged. Change subject: Switch near match to use better hook ......................................................................
Switch near match to use better hook - We're the only user of SearchGetNearMatchBefore, which I'd like to remove - We don't actually check other variants, despite our claims in a comment - By using the later hook, we get to check all variants plus let MW title munging have a crack at things first Change-Id: Ie3ca6393a9c8699a8d2979446adc5e0cef304616 --- M includes/Hooks.php 1 file changed, 4 insertions(+), 6 deletions(-) Approvals: Manybubbles: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Hooks.php b/includes/Hooks.php index 85e0ec7..2acb6b8 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -82,7 +82,7 @@ // Install our prefix search hook only if we're enabled. if ( $wgSearchType === 'CirrusSearch' ) { $wgHooks[ 'PrefixSearchBackend' ][] = 'CirrusSearch\Hooks::prefixSearch'; - $wgHooks[ 'SearchGetNearMatchBefore' ][] = 'CirrusSearch\Hooks::onSearchGetNearMatchBefore'; + $wgHooks[ 'SearchGetNearMatch' ][] = 'CirrusSearch\Hooks::onSearchGetNearMatch'; } if ( $request ) { @@ -328,16 +328,14 @@ } /** - * Let Elasticsearch take a crack at getting near matches before mediawiki tries all kinds of variants. - * @param array(string) $termAnAllLanguageVariants the original search term and all language variants + * Let Elasticsearch take a crack at getting near matches once mediawiki has tried all kinds of variants. + * @param string $term the original search term and all language variants * @param null|Title $titleResult resulting match. A Title if we found something, unchanged otherwise. * @return bool return false if we find something, true otherwise so mediawiki can try its default behavior */ - public static function onSearchGetNearMatchBefore( $termAndAllLanguageVariants, &$titleResult ) { + public static function onSearchGetNearMatch( $term, &$titleResult ) { global $wgContLang; - // Elasticsearch should handle all language variants. If it doesn't, we'll have to make it do so. - $term = $termAndAllLanguageVariants[ 0 ]; $title = Title::newFromText( $term ); if ( $title === null ) { return false; -- To view, visit https://gerrit.wikimedia.org/r/141065 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie3ca6393a9c8699a8d2979446adc5e0cef304616 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits