$out->addHTML( $dymWidget->render( $term, $textMatches ) );
}
- $hasErrors = $textStatus && $textStatus->getErrors();
+ $hasErrors = $textStatus && $textStatus->getErrors() !== [];
$hasOtherResults = $textMatches &&
$textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS );
if ( $hasErrors ) {
list( $error, $warning ) = $textStatus->splitByErrorType();
if ( $error->getErrors() ) {
- $out->addHTML( Html::rawElement(
- 'div',
- [ 'class' => 'errorbox' ],
+ $out->addHTML( Html::errorBox(
$error->getHTML( 'search-error' )
) );
}
if ( $warning->getErrors() ) {
- $out->addHTML( Html::rawElement(
- 'div',
- [ 'class' => 'warningbox' ],
+ $out->addHTML( Html::warningBox(
$warning->getHTML( 'search-warning' )
) );
}
// 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
if ( strval( $term ) !== '' ) {
$out->setPageTitle( $this->msg( 'searchresults' ) );
$out->setHTMLTitle( $this->msg( 'pagetitle' )
- ->rawParams( $this->msg( 'searchresults-title' )->rawParams( $term )->text() )
+ ->plaintextParams( $this->msg( 'searchresults-title' )->plaintextParams( $term )->text() )
->inContentLanguage()->text()
);
}
* Extract "power search" namespace settings from the request object,
* returning a list of index numbers to search.
*
- * @param WebRequest $request
+ * @param WebRequest &$request
* @return array
*/
protected function powerSearch( &$request ) {