return false;
}
$extractedNamespace = null;
+ $allkeywords = [];
- $allkeyword = wfMessage( 'searchall' )->inContentLanguage()->text() . ":";
- if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) {
- $extractedNamespace = null;
- $parsed = substr( $query, strlen( $allkeyword ) );
- } elseif ( strpos( $query, ':' ) !== false ) {
+ $allkeywords[] = wfMessage( 'searchall' )->inContentLanguage()->text() . ":";
+ // force all: so that we have a common syntax for all the wikis
+ if ( !in_array( 'all:', $allkeywords ) ) {
+ $allkeywords[] = 'all:';
+ }
+
+ $allQuery = false;
+ foreach ( $allkeywords as $kw ) {
+ if ( strncmp( $query, $kw, strlen( $kw ) ) == 0 ) {
+ $extractedNamespace = null;
+ $parsed = substr( $query, strlen( $kw ) );
+ $allQuery = true;
+ break;
+ }
+ }
+
+ if ( !$allQuery && strpos( $query, ':' ) !== false ) {
// TODO: should we unify with PrefixSearch::extractNamespace ?
$prefix = str_replace( ' ', '_', substr( $query, 0, strpos( $query, ':' ) ) );
$index = $wgContLang->getNsIndex( $prefix );
// no-op
}
- /**
- * Get OpenSearch suggestion template
- *
- * @deprecated since 1.25
- * @return string
- */
- public static function getOpenSearchTemplate() {
- wfDeprecated( __METHOD__, '1.25' );
- return ApiOpenSearch::getOpenSearchTemplate( 'application/x-suggestions+json' );
- }
-
/**
* Get the raw text for updating the index from a content object
* Nicer search backends could possibly do something cooler than
$this->setLimitOffset( $fallbackLimit );
$fallbackSearchResult = $this->completionSearch( $fbs );
$results->appendAll( $fallbackSearchResult );
- $fallbackLimit -= count( $fallbackSearchResult );
+ $fallbackLimit -= $fallbackSearchResult->getSize();
if ( $fallbackLimit <= 0 ) {
break;
}