From: Brion Vibber Date: Tue, 28 Jul 2009 20:49:01 +0000 (+0000) Subject: *slap self* fix hit counts for title searches when counts in mysql are enabled. X-Git-Tag: 1.31.0-rc.0~40659 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=a4b5ffe4591fd78126b02377145e14627373971e;p=lhc%2Fweb%2Fwiklou.git *slap self* fix hit counts for title searches when counts in mysql are enabled. --- diff --git a/includes/SearchMySQL.php b/includes/SearchMySQL.php index 3d04466ba6..24ee4dfa83 100644 --- a/includes/SearchMySQL.php +++ b/includes/SearchMySQL.php @@ -148,14 +148,28 @@ class SearchMySQL extends SearchEngine { * @return MySQLSearchResultSet */ function searchText( $term ) { + return $this->searchInternal( $term, true ); + } + + /** + * Perform a title-only search query and return a result set. + * + * @param $term String: raw search term + * @return MySQLSearchResultSet + */ + function searchTitle( $term ) { + return $this->searchInternal( $term, false ); + } + + protected function searchInternal( $term, $fulltext ) { global $wgSearchMySQLTotalHits; $filteredTerm = $this->filter( $term ); - $resultSet = $this->db->query( $this->getQuery( $filteredTerm, true ) ); + $resultSet = $this->db->query( $this->getQuery( $filteredTerm, $fulltext ) ); $total = null; if( $wgSearchMySQLTotalHits ) { - $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, true ) ); + $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, $fulltext ) ); $row = $totalResult->fetchObject(); if( $row ) { $total = $row->c; @@ -166,17 +180,6 @@ class SearchMySQL extends SearchEngine { return new MySQLSearchResultSet( $resultSet, $this->searchTerms, $total ); } - /** - * Perform a title-only search query and return a result set. - * - * @param $term String: raw search term - * @return MySQLSearchResultSet - */ - function searchTitle( $term ) { - $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) ); - return new MySQLSearchResultSet( $resultSet, $this->searchTerms ); - } - /** * Return a partial WHERE clause to exclude redirects, if so set