summaryrefslogtreecommitdiff
path: root/includes/SearchEngine.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
commitcecb985bee3bdd252e1b8dc0bd500b37cd52be01 (patch)
tree17266aa237742640aabee7856f0202317a45d540 /includes/SearchEngine.php
parent0bac06c301f2a83edb0236e4c2434da16848d549 (diff)
Aktualisierung auf MediaWiki 1.10.0
Plugins angepasst und verbessert kleine Korrekturen am Design
Diffstat (limited to 'includes/SearchEngine.php')
-rw-r--r--includes/SearchEngine.php48
1 files changed, 33 insertions, 15 deletions
diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php
index cec40c91..24795ba9 100644
--- a/includes/SearchEngine.php
+++ b/includes/SearchEngine.php
@@ -1,12 +1,7 @@
<?php
/**
* Contain a class for special pages
- * @package MediaWiki
- * @subpackage Search
- */
-
-/**
- * @package MediaWiki
+ * @addtogroup Search
*/
class SearchEngine {
var $limit = 10;
@@ -124,17 +119,33 @@ class SearchEngine {
if ( $title->getNamespace() == NS_USER ) {
return $title;
}
+
+ # Go to images that exist even if there's no local page.
+ # There may have been a funny upload, or it may be on a shared
+ # file repository such as Wikimedia Commons.
+ if( $title->getNamespace() == NS_IMAGE ) {
+ $image = new Image( $title );
+ if( $image->exists() ) {
+ return $title;
+ }
+ }
+
+ # MediaWiki namespace? Page may be "implied" if not customized.
+ # Just return it, with caps forced as the message system likes it.
+ if( $title->getNamespace() == NS_MEDIAWIKI ) {
+ return Title::makeTitle( NS_MEDIAWIKI, $wgContLang->ucfirst( $title->getText() ) );
+ }
# Quoted term? Try without the quotes...
$matches = array();
if( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) {
return SearchEngine::getNearMatch( $matches[1] );
}
-
+
return NULL;
}
- function legalSearchChars() {
+ public static function legalSearchChars() {
return "A-Za-z_'0-9\\x80-\\xFF\\-";
}
@@ -193,9 +204,8 @@ class SearchEngine {
* active database backend, and return a configured instance.
*
* @return SearchEngine
- * @private
*/
- function create() {
+ public static function create() {
global $wgDBtype, $wgSearchType;
if( $wgSearchType ) {
$class = $wgSearchType;
@@ -203,6 +213,8 @@ class SearchEngine {
$class = 'SearchMySQL4';
} else if ( $wgDBtype == 'postgres' ) {
$class = 'SearchPostgres';
+ } else if ( $wgDBtype == 'oracle' ) {
+ $class = 'SearchOracle';
} else {
$class = 'SearchEngineDummy';
}
@@ -232,12 +244,15 @@ class SearchEngine {
* @param string $title
* @abstract
*/
- function updateTitle( $id, $title ) {
+ function updateTitle( $id, $title ) {
// no-op
- }
+ }
}
-/** @package MediaWiki */
+
+/**
+ * @addtogroup Search
+ */
class SearchResultSet {
/**
* Fetch an array of regular expression fragments for matching
@@ -312,7 +327,10 @@ class SearchResultSet {
}
}
-/** @package MediaWiki */
+
+/**
+ * @addtogroup Search
+ */
class SearchResult {
function SearchResult( $row ) {
$this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
@@ -335,7 +353,7 @@ class SearchResult {
}
/**
- * @package MediaWiki
+ * @addtogroup Search
*/
class SearchEngineDummy {
function search( $term ) {