From 370e83bb0dfd0c70de268c93bf07ad5ee0897192 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 Aug 2008 01:29:47 +0200 Subject: Update auf 1.13.0 --- includes/SearchPostgres.php | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'includes/SearchPostgres.php') diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php index 59110a5a..88e4a0da 100644 --- a/includes/SearchPostgres.php +++ b/includes/SearchPostgres.php @@ -17,19 +17,24 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 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 { } } } - - - -- cgit v1.2.2