/**
* Perform a full text search query and return a result set.
* If full text searches are not supported or disabled, return null.
- * STUB
+ *
+ * As of 1.32 overriding this function is deprecated. It will
+ * be converted to final in 1.34. Override self::doSearchText().
*
* @param string $term Raw search term
* @return SearchResultSet|Status|null
*/
- function searchText( $term ) {
+ public function searchText( $term ) {
+ return $this->doSearchText( $term );
+ }
+
+ /**
+ * Perform a full text search query and return a result set.
+ *
+ * @param string $term Raw search term
+ * @return SearchResultSet|Status|null
+ * @since 1.32
+ */
+ protected function doSearchText( $term ) {
return null;
}
* The results returned by this methods are only sugegstions and
* may not end up being shown to the user.
*
+ * As of 1.32 overriding this function is deprecated. It will
+ * be converted to final in 1.34. Override self::doSearchArchiveTitle().
+ *
* @param string $term Raw search term
* @return Status<Title[]>
* @since 1.29
*/
- function searchArchiveTitle( $term ) {
+ public function searchArchiveTitle( $term ) {
+ return $this->doSearchArchiveTitle( $term );
+ }
+
+ /**
+ * Perform a title search in the article archive.
+ *
+ * @param string $term Raw search term
+ * @return Status<Title[]>
+ * @since 1.32
+ */
+ protected function doSearchArchiveTitle( $term ) {
return Status::newGood( [] );
}
* If title searches are not supported or disabled, return null.
* STUB
*
+ * As of 1.32 overriding this function is deprecated. It will
+ * be converted to final in 1.34. Override self::doSearchTitle().
+ *
+ * @param string $term Raw search term
+ * @return SearchResultSet|null
+ */
+ public function searchTitle( $term ) {
+ return $this->doSearchTitle( $term );
+ }
+
+ /**
+ * Perform a title-only search query and return a result set.
+ *
* @param string $term Raw search term
* @return SearchResultSet|null
+ * @since 1.32
*/
- function searchTitle( $term ) {
+ protected function doSearchTitle( $term ) {
return null;
}
return false;
}
$extractedNamespace = null;
+ $allkeywords = [];
+
+ $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;
+ }
+ }
- $allkeyword = wfMessage( 'searchall' )->inContentLanguage()->text() . ":";
- if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) {
- $extractedNamespace = null;
- $parsed = substr( $query, strlen( $allkeyword ) );
- } elseif ( strpos( $query, ':' ) !== false ) {
+ if ( !$allQuery && strpos( $query, ':' ) !== false ) {
// TODO: should we unify with PrefixSearch::extractNamespace ?
$prefix = str_replace( ' ', '_', substr( $query, 0, strpos( $query, ':' ) ) );
$index = $wgContLang->getNsIndex( $prefix );