X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchPostgres.php;h=42b67f36799b738a10f970666b7383a68a2044ca;hb=ed945112a8640fcaefa0128456602893294aee31;hp=142e5fd88486c2286489469d4c29cd9c636863bd;hpb=7a74e085d926a2a8bcb5d2ef1a703e3c72ca083a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php index 142e5fd884..42b67f3679 100644 --- a/includes/search/SearchPostgres.php +++ b/includes/search/SearchPostgres.php @@ -34,7 +34,7 @@ class SearchPostgres extends SearchDatabase { * Currently searches a page's current title (page.page_title) and * latest revision article text (pagecontent.old_text) * - * @param string $term raw search term + * @param string $term Raw search term * @return PostgresSearchResultSet */ function searchTitle( $term ) { @@ -64,7 +64,7 @@ class SearchPostgres extends SearchDatabase { * Transform the user's search string into a better form for tsearch2 * Returns an SQL fragment consisting of quoted text to search for. * - * @param $term string + * @param string $term * * @return string */ @@ -130,9 +130,9 @@ class SearchPostgres extends SearchDatabase { /** * Construct the full SQL query to do the search. - * @param $term String - * @param $fulltext String - * @param $colname + * @param string $term + * @param string $fulltext + * @param string $colname * @return string */ function searchQuery( $term, $fulltext, $colname ) { @@ -168,11 +168,6 @@ class SearchPostgres extends SearchDatabase { "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery($searchstring)"; } - ## Redirects - if ( !$this->showRedirects ) { - $query .= ' AND page_is_redirect = 0'; - } - ## Namespaces - defaults to 0 if ( !is_null( $this->namespaces ) ) { // null -> search all if ( count( $this->namespaces ) < 1 ) { @@ -196,7 +191,7 @@ class SearchPostgres extends SearchDatabase { function update( $pageid, $title, $text ) { ## We don't want to index older revisions - $sql = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN " . + $sql = "UPDATE pagecontent SET textvector = NULL WHERE textvector IS NOT NULL and old_id IN " . "(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) . " ORDER BY rev_text_id DESC OFFSET 1)"; $this->db->query( $sql ); @@ -227,12 +222,8 @@ class PostgresSearchResult extends SearchResult { * @ingroup Search */ class PostgresSearchResultSet extends SqlSearchResultSet { - function __construct( $resultSet, $terms ) { - parent::__construct( $resultSet, $terms ); - } - function next() { - $row = $this->mResultSet->fetchObject(); + $row = $this->resultSet->fetchObject(); if ( $row === false ) { return false; } else {