EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/258076
Change subject: Include language detection results in control bucket
......................................................................
Include language detection results in control bucket
This is necessary to properly report the control buckets to
the user testing logs. Without it analysis would have to
manually reconstruct which control users could have been
in the test which, while possible, is not going to be as
provably accurate.
For users not participating in the test
$wgCirrusSearchLanguageDetectors will be an empty array
so this should result in unnoticable latency increases.
Change-Id: Ic885be900209eca7b15f2f2fa47036e1de082596
---
M includes/CirrusSearch.php
1 file changed, 20 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/76/258076/1
diff --git a/includes/CirrusSearch.php b/includes/CirrusSearch.php
index 979af69..1451ee3 100644
--- a/includes/CirrusSearch.php
+++ b/includes/CirrusSearch.php
@@ -121,28 +121,37 @@
return null;
}
- // check whether we have second language functionality enabled
- if ( !$GLOBALS['wgCirrusSearchEnableAltLanguage'] ) {
- return null;
- }
-
+ $detected = null;
$arguments = array( $this, $term );
foreach ( $GLOBALS['wgCirrusSearchLanguageDetectors'] as $name
=> $callback ) {
$lang = call_user_func_array( $callback, $arguments );
$wiki = self::wikiForLanguage( $lang );
if ( $wiki !== null ) {
// it might be more accurate to attach these to
the 'next'
- // log context?
+ // log context? It would be inconsistent with
the
+ // langdetect => false condition which does not
have a next
+ // request though.
Searcher::appendLastLogContext( array(
'langdetect' => $name,
) );
- return $wiki;
+ $detected = $wiki;
+ break;
}
}
- Searcher::appendLastLogContext( array(
- 'langdetect' => 'failed',
- ) );
- return null;
+ if ( $detected === null ) {
+ Searcher::appendLastLogContext( array(
+ 'langdetect' => 'failed',
+ ) );
+ }
+
+ // check whether we have second language functionality enabled.
+ // This comes after the actual detection so we can include the
+ // results of detection in AB test control buckets.
+ if ( !$GLOBALS['wgCirrusSearchEnableAltLanguage'] ) {
+ return null;
+ }
+
+ return $detected;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/258076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic885be900209eca7b15f2f2fa47036e1de082596
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits