summaryrefslogtreecommitdiff
path: root/includes/SearchMySQL.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/SearchMySQL.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/SearchMySQL.php')
-rw-r--r--includes/SearchMySQL.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/includes/SearchMySQL.php b/includes/SearchMySQL.php
index f9b71c8e..5fc06790 100644
--- a/includes/SearchMySQL.php
+++ b/includes/SearchMySQL.php
@@ -34,7 +34,10 @@ class SearchMySQL extends SearchEngine {
$this->db = $db;
}
- /** @todo document */
+ /**
+ * Parse the user's query and transform it into an SQL fragment which will
+ * become part of a WHERE clause
+ */
function parseQuery( $filteredText, $fulltext ) {
global $wgContLang;
$lc = SearchEngine::legalSearchChars(); // Minus format chars
@@ -54,7 +57,11 @@ class SearchMySQL extends SearchEngine {
if( !empty( $terms[3] ) ) {
// Match individual terms in result highlighting...
$regexp = preg_quote( $terms[3], '/' );
- if( $terms[4] ) $regexp .= "[0-9A-Za-z_]+";
+ if( $terms[4] ) {
+ $regexp = "\b$regexp"; // foo*
+ } else {
+ $regexp = "\b$regexp\b";
+ }
} else {
// Match the quoted term in result highlighting...
$regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' );
@@ -122,9 +129,10 @@ class SearchMySQL extends SearchEngine {
function queryNamespaces() {
if( is_null($this->namespaces) )
return ''; # search all
- $namespaces = implode( ',', $this->namespaces );
- if ($namespaces == '') {
+ if ( !count( $this->namespaces ) ) {
$namespaces = '0';
+ } else {
+ $namespaces = $this->db->makeList( $this->namespaces );
}
return 'AND page_namespace IN (' . $namespaces . ')';
}