EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/288465
Change subject: Adjust textcat data collection for AB test ...................................................................... Adjust textcat data collection for AB test * Adds two new extra variables reported to frontend js about textcat * In addition to checking language also runs the query and reports results to JS of language detection when alt language search is disabled. This allows to collect information on the control bucket Bug: T121542 Change-Id: I44fded97726b1d7649331d5c839f379659b33cc0 (cherry picked from commit 4bc2b3b92bd49c65fbfccd48c7397077f3639f1b) --- M includes/CirrusSearch.php 1 file changed, 22 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/65/288465/1 diff --git a/includes/CirrusSearch.php b/includes/CirrusSearch.php index 850c458..fd3b806 100644 --- a/includes/CirrusSearch.php +++ b/includes/CirrusSearch.php @@ -46,9 +46,15 @@ private $lastNamespacePrefix; /** - * @var array metrics about the last thing we searched + * @var array metrics about the last thing we searched sourced from the + * Searcher instance */ - private $lastSearchMetrics; + private $lastSearchMetrics = array(); + + /** + * @var array additional metrics about the search sourced within this class + */ + private $extraSearchMetrics = array(); /** * @var string @@ -203,13 +209,9 @@ 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; + } else { + // Report language detection with search metrics + $this->extraSearchMetrics['wgCirrusSearchAltLanguage'] = $detected; } return $detected; @@ -287,8 +289,16 @@ } if ( $config ) { $matches = $this->searchTextReal( $term, $config ); - if ( $matches instanceof ResultSet && $matches->numRows() > 0 ) { - $oldResult->addInterwikiResults( $matches, SearchResultSet::INLINE_RESULTS, $altWiki[1] ); + if ( $matches instanceof ResultSet ) { + $numRows = $matches->numRows(); + $this->extraSearchMetrics['wgCirrusSearchAltLanguageNumResults'] = $numRows; + // check whether we have second language functionality enabled. + // This comes after the actual query is run so we can collect metrics about + // users in the control buckets, and provide them the same latency as users + // in the test bucket. + if ( $GLOBALS['wgCirrusSearchEnableAltLanguage'] && $numRows > 0) { + $oldResult->addInterwikiResults( $matches, SearchResultSet::INLINE_RESULTS, $altWiki[1] ); + } } } } @@ -528,7 +538,7 @@ * @return array */ public function getLastSearchMetrics() { - return $this->lastSearchMetrics; + return $this->lastSearchMetrics + $this->extraSearchMetrics; } protected function completionSuggesterEnabled( SearchConfig $config ) { -- To view, visit https://gerrit.wikimedia.org/r/288465 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I44fded97726b1d7649331d5c839f379659b33cc0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: wmf/1.28.0-wmf.1 Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits