User:Nx/Extensions/SearchMySQL prefix patch
< User:Nx | Extensions
Jump to navigation
Jump to search
--- SearchMySQL.php.bak 2009-10-31 06:15:34.000000000 -0400
+++ SearchMySQL.php 2009-10-31 07:35:07.000000000 -0400
@@ -137,6 +137,13 @@
return 'AND page_namespace IN (' . $namespaces . ')';
}
+ function queryPrefix() {
+ if( is_null($this->prefix) || $this->prefix == '' ) {
+ return ''; # search all
+ }
+ return 'AND page_title LIKE "' . $this->db->escapeLike(str_replace( ' ', '_', $this->prefix )) . '%"';
+ }
+
/**
* Return a LIMIT clause to limit results on the query.
* @return string
@@ -167,6 +174,7 @@
return $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
$this->queryRedirect() . ' ' .
$this->queryNamespaces() . ' ' .
+ $this->queryPrefix() . ' ' .
$this->queryRanking( $filteredTerm, $fulltext ) . ' ' .
$this->queryLimit();
}