r53899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53898‎ | r53899 | r53900 >
Date:20:49, 28 July 2009
Author:brion
Status:ok
Tags:
Comment:
*slap self* fix hit counts for title searches when counts in mysql are enabled.
Modified paths:
  • /trunk/phase3/includes/SearchMySQL.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SearchMySQL.php
@@ -148,14 +148,28 @@
149149 * @return MySQLSearchResultSet
150150 */
151151 function searchText( $term ) {
 152+ return $this->searchInternal( $term, true );
 153+ }
 154+
 155+ /**
 156+ * Perform a title-only search query and return a result set.
 157+ *
 158+ * @param $term String: raw search term
 159+ * @return MySQLSearchResultSet
 160+ */
 161+ function searchTitle( $term ) {
 162+ return $this->searchInternal( $term, false );
 163+ }
 164+
 165+ protected function searchInternal( $term, $fulltext ) {
152166 global $wgSearchMySQLTotalHits;
153167
154168 $filteredTerm = $this->filter( $term );
155 - $resultSet = $this->db->query( $this->getQuery( $filteredTerm, true ) );
 169+ $resultSet = $this->db->query( $this->getQuery( $filteredTerm, $fulltext ) );
156170
157171 $total = null;
158172 if( $wgSearchMySQLTotalHits ) {
159 - $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, true ) );
 173+ $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, $fulltext ) );
160174 $row = $totalResult->fetchObject();
161175 if( $row ) {
162176 $total = $row->c;
@@ -166,18 +180,7 @@
167181 return new MySQLSearchResultSet( $resultSet, $this->searchTerms, $total );
168182 }
169183
170 - /**
171 - * Perform a title-only search query and return a result set.
172 - *
173 - * @param $term String: raw search term
174 - * @return MySQLSearchResultSet
175 - */
176 - function searchTitle( $term ) {
177 - $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
178 - return new MySQLSearchResultSet( $resultSet, $this->searchTerms );
179 - }
180184
181 -
182185 /**
183186 * Return a partial WHERE clause to exclude redirects, if so set
184187 * @return String

Status & tagging log