r58274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58273‎ | r58274 | r58275 >
Date:19:05, 28 October 2009
Author:maxsem
Status:deferred
Tags:
Comment:
Comments and refactoring
Modified paths:
  • /branches/sqlite/includes/search/SearchSqlite.php (modified) (history)

Diff [purge]

Index: branches/sqlite/includes/search/SearchSqlite.php
@@ -28,7 +28,10 @@
2929 class SearchSqlite extends SearchEngine {
3030 var $strictMatching = true;
3131
32 - /** @todo document */
 32+ /**
 33+ * Creates an instance of this class
 34+ * @param $db DatabaseSqlite: database object
 35+ */
3336 function __construct( $db ) {
3437 $this->db = $db;
3538 }
@@ -208,11 +211,12 @@
209212 }
210213
211214 /**
212 - * Return a LIMIT clause to limit results on the query.
 215+ * Returns a query with limit for number of results set.
 216+ * @param $sql String:
213217 * @return String
214218 */
215 - function queryLimit() {
216 - return $this->db->limitResult( '', $this->limit, $this->offset );
 219+ function limitResult( $sql ) {
 220+ return $this->db->limitResult( $sql, $this->limit, $this->offset );
217221 }
218222
219223 /**
@@ -231,11 +235,12 @@
232236 * @param $fulltext Boolean
233237 */
234238 function getQuery( $filteredTerm, $fulltext ) {
235 - return $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
 239+ return $this->limitResult(
 240+ $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
236241 $this->queryRedirect() . ' ' .
237242 $this->queryNamespaces() . ' ' .
238 - $this->queryRanking( $filteredTerm, $fulltext ) . ' ' .
239 - $this->queryLimit();
 243+ $this->queryRanking( $filteredTerm, $fulltext )
 244+ );
240245 }
241246
242247 /**
@@ -306,8 +311,7 @@
307312 $dbw->update( 'searchindex',
308313 array( 'si_title' => $title ),
309314 array( 'si_page' => $id ),
310 - __METHOD__,
311 - array( $dbw->lowPriorityOption() ) );
 315+ __METHOD__ );
312316 }
313317 }
314318

Status & tagging log