Merge "Support custom offsets from SearchResultSet"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 19 Jul 2017 10:57:28 +0000 (10:57 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 19 Jul 2017 10:57:28 +0000 (10:57 +0000)
1  2 
includes/specials/SpecialSearch.php

@@@ -399,6 -399,7 +399,6 @@@ class SpecialSearch extends SpecialPag
                $mainResultWidget = new FullSearchResultWidget( $this, $linkRenderer );
  
                if ( $search->getFeatureData( 'enable-new-crossproject-page' ) ) {
 -
                        $sidebarResultWidget = new InterwikiSearchResultWidget( $this, $linkRenderer );
                        $sidebarResultsWidget = new InterwikiSearchResultSetWidget(
                                $this,
  
                // prev/next links
                if ( $totalRes > $this->limit || $this->offset ) {
+                       // Allow matches to define the correct offset, as interleaved
+                       // AB testing may require a different next page offset.
+                       if ( $textMatches && $textMatches->getOffset() !== null ) {
+                               $offset = $textMatches->getOffset();
+                       } else {
+                               $offset = $this->offset;
+                       }
                        $prevnext = $this->getLanguage()->viewPrevNext(
                                $this->getPageTitle(),
-                               $this->offset,
+                               $offset,
                                $this->limit,
                                $this->powerSearchOptions() + [ 'search' => $term ],
                                $this->limit + $this->offset >= $totalRes