$result->setExtensionData( $this->extraData[$id] );
return $this->extraData[$id];
}
+
+ /**
+ * @return int|null The offset the current page starts at. Typically
+ * this should be null to allow the UI to decide on its own, but in
+ * special cases like interleaved AB tests specifying explicitly is
+ * necessary.
+ */
+ public function getOffset() {
+ return null;
+ }
}
// 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