Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/141065
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(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/65/141065/1
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 85e0ec7..e441678 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,15 @@
}
/**
- * 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: newchange
Gerrit-Change-Id: Ie3ca6393a9c8699a8d2979446adc5e0cef304616
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits