jenkins-bot has submitted this change and it was merged.

Change subject: Textcat search satisfaction subtest for multiple wikis
......................................................................


Textcat search satisfaction subtest for multiple wikis

This patch re-adds the textcat subtest with a few changes from the last
iteration:

* Records if the clicked link is an interwiki result. This is done by
  only recording the 3 value textcat parameters to extraParams for the
  searchResultPage event. The click event now records an integer 1 or 0
  in the extraParams field. 1 indicates an interwiki click, 0 indicates
  a local result click.
* extraParams for the fulltext searchResultPage event now always has 3
  values, although some may be blank. If no values are available the
  extraParams field will be: ',,'. When split by later analytics
  processing on the , that would become ['','',''].
* The third field of extraParams now correctly records a 0, rather than
  being empty, when the query was run against an alternate wiki but no
  results were found.

Identified as not being incorrect.

* The third value of extraParams should always be <=
  hitsReturned. In our logging of results this is not always the case.
  This turns out to be because users in the control group run the query,
  report the number of results, but are not shown the results. As such
  no fix was done here it was only a problem with how to interpret the
  data.

Depends-On: I02a83aa88
Bug: T121543
Bug: T137163
Bug: T137167
Change-Id: I95ba0a932292c46a8de633ab027645343617fd6d
---
M modules/ext.wikimediaEvents.searchSatisfaction.js
1 file changed, 48 insertions(+), 7 deletions(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ext.wikimediaEvents.searchSatisfaction.js 
b/modules/ext.wikimediaEvents.searchSatisfaction.js
index e32762b..6e9e5af 100644
--- a/modules/ext.wikimediaEvents.searchSatisfaction.js
+++ b/modules/ext.wikimediaEvents.searchSatisfaction.js
@@ -99,9 +99,11 @@
                 * @private
                 */
                function initialize( session ) {
-
                        var sessionId = session.get( 'sessionId' ),
-                               sampleSize = 200,
+                               haveSubTest = [
+                                       'enwiki', 'frwiki', 'eswiki', 'itwiki', 
'dewiki'
+                               ].indexOf( mw.config.get( 'wgDBname' ) ) !== -1,
+                               sampleSize = haveSubTest ? 100 : 200,
                                /**
                                 * Determines whether the user is part of the 
population size.
                                 *
@@ -150,6 +152,15 @@
                                // have a search session id, generate one.
                                if ( !session.set( 'sessionId', randomToken() ) 
) {
                                        return false;
+                               }
+
+                               // Assign 50% of users to subTest
+                               if ( haveSubTest && oneIn( 2 ) ) {
+                                       session.set( 'subTest', chooseBucket( [
+                                               'textcat2:a',
+                                               'textcat2:b',
+                                               'textcat2:c'
+                                       ] ) );
                                }
                        }
 
@@ -383,6 +394,10 @@
                                evt.articleId = articleId;
                        }
 
+                       if ( mw.config.get( 'wgCirrusSearchRequestSetToken' ) ) 
{
+                               evt.searchToken = mw.config.get( 
'wgCirrusSearchRequestSetToken' );
+                       }
+
                        // add any schema specific data
                        if ( extraData ) {
                                $.extend( evt, extraData );
@@ -406,6 +421,7 @@
         */
        function setupSearchTest( session ) {
                var params,
+                       textCatExtra = [],
                        logEvent = genLogEventFn( 'fulltext', session );
 
                if ( isSearchResultPage ) {
@@ -425,19 +441,39 @@
                                                        .find( 
'[data-serp-pos]' )
                                                        .data( 'serp-pos' );
 
-                                       if ( index !== undefined ) {
+                                       // If wprov is already defined it must 
have come from the
+                                       // backend interwiki test. Don't 
override it. This means we
+                                       // won't get a visitPage event, but we 
can't collect those
+                                       // for interwiki anyways.
+                                       if ( index !== undefined && 
uri.query.wprov === undefined ) {
                                                uri.query.wprov = 
search.wprovPrefix + index;
                                                $target.attr( 'href', 
uri.toString() );
                                        }
                                        logEvent( 'click', {
-                                               position: index
+                                               position: index,
+                                               // specific to textcat subtest. 
Links starting with // point to
+                                               // an alternate wiki.
+                                               extraParams: $target.attr( 
'href' ).substr( 0, 2 ) === '//' ? 1 : 0
                                        } );
                                }
                        );
 
+                       // specific to textcat subtest
+                       if ( mw.config.get( 'wgCirrusSearchAltLanguage' ) ) {
+                               textCatExtra = $.extend( [], mw.config.get( 
'wgCirrusSearchAltLanguage' ) );
+                       } else {
+                               textCatExtra = [ null, null ];
+                       }
+                       if ( mw.config.get( 
'wgCirrusSearchAltLanguageNumResults' ) !== null ) {
+                               textCatExtra.push( mw.config.get( 
'wgCirrusSearchAltLanguageNumResults' ) );
+                       } else {
+                               textCatExtra.push( null );
+                       }
+
                        params = {
                                query: mw.config.get( 'searchTerm' ),
-                               hitsReturned: $( '.mw-search-result-heading' 
).length
+                               hitsReturned: $( '.mw-search-result-heading' 
).length,
+                               extraParams: textCatExtra.join( ',' )
                        };
                        if ( window.performance && window.performance.timing ) {
                                params.msToDisplayResults = 
window.performance.timing.domComplete - 
window.performance.timing.navigationStart;
@@ -536,8 +572,13 @@
        // text setup, so wrap in atMostOnce to ensure it's
        // only run once.
        initSubTest = atMostOnce( function ( session ) {
-               // jshint unused:false
-               // no sub test currently running
+               if ( session.get( 'subTest' ) ) {
+                       $( '<input>' ).attr( {
+                               type: 'hidden',
+                               name: 'cirrusUserTesting',
+                               value: session.get( 'subTest' )
+                       } ).prependTo( $( 'input[type=search]' ).closest( 
'form' ) );
+               }
        } );
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/294773
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I95ba0a932292c46a8de633ab027645343617fd6d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: wmf/1.28.0-wmf.6
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to