summaryrefslogtreecommitdiff
path: root/includes/SearchPostgres.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/SearchPostgres.php')
-rw-r--r--includes/SearchPostgres.php36
1 files changed, 20 insertions, 16 deletions
diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php
index 59110a5a..88e4a0da 100644
--- a/includes/SearchPostgres.php
+++ b/includes/SearchPostgres.php
@@ -18,18 +18,23 @@
# http://www.gnu.org/copyleft/gpl.html
/**
+ * @file
+ * @ingroup Search
+ */
+
+/**
* Search engine hook base class for Postgres
- * @addtogroup Search
+ * @ingroup Search
*/
class SearchPostgres extends SearchEngine {
- function SearchPostgres( $db ) {
+ function __construct( $db ) {
$this->db = $db;
}
/**
* Perform a full text search query via tsearch2 and return a result set.
- * Currently searches a page's current title (page.page_title) and
+ * Currently searches a page's current title (page.page_title) and
* latest revision article text (pagecontent.old_text)
*
* @param string $term - Raw search term
@@ -174,11 +179,13 @@ class SearchPostgres extends SearchEngine {
$query .= ' AND page_is_redirect = 0';
## Namespaces - defaults to 0
- if ( count($this->namespaces) < 1)
- $query .= ' AND page_namespace = 0';
- else {
- $namespaces = implode( ',', $this->namespaces );
- $query .= " AND page_namespace IN ($namespaces)";
+ if( !is_null($this->namespaces) ){ // null -> search all
+ if ( count($this->namespaces) < 1)
+ $query .= ' AND page_namespace = 0';
+ else {
+ $namespaces = implode( ',', $this->namespaces );
+ $query .= " AND page_namespace IN ($namespaces)";
+ }
}
$query .= " ORDER BY score DESC, page_id DESC";
@@ -208,11 +215,11 @@ class SearchPostgres extends SearchEngine {
} ## end of the SearchPostgres class
/**
- * @addtogroup Search
+ * @ingroup Search
*/
class PostgresSearchResult extends SearchResult {
- function PostgresSearchResult( $row ) {
- $this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
+ function __construct( $row ) {
+ parent::__construct($row);
$this->score = $row->score;
}
function getScore() {
@@ -221,10 +228,10 @@ class PostgresSearchResult extends SearchResult {
}
/**
- * @addtogroup Search
+ * @ingroup Search
*/
class PostgresSearchResultSet extends SearchResultSet {
- function PostgresSearchResultSet( $resultSet, $terms ) {
+ function __construct( $resultSet, $terms ) {
$this->mResultSet = $resultSet;
$this->mTerms = $terms;
}
@@ -246,6 +253,3 @@ class PostgresSearchResultSet extends SearchResultSet {
}
}
}
-
-
-