return new SqlSearchResultSet( false, '' );
}
- $resultSet = $this->db->query( $this->getQuery( $this->filter( $term ), true ) );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $resultSet = $dbr->query( $this->getQuery( $this->filter( $term ), true ) );
return new SqlSearchResultSet( $resultSet, $this->searchTerms );
}
return new SqlSearchResultSet( false, '' );
}
- $resultSet = $this->db->query( $this->getQuery( $this->filter( $term ), false ) );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $resultSet = $dbr->query( $this->getQuery( $this->filter( $term ), false ) );
return new SqlSearchResultSet( $resultSet, $this->searchTerms );
}
if ( $this->namespaces === [] ) {
$namespaces = '0';
} else {
- $namespaces = $this->db->makeList( $this->namespaces );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $namespaces = $dbr->makeList( $this->namespaces );
}
return 'AND page_namespace IN (' . $namespaces . ')';
}
* @return string
*/
private function queryLimit( $sql ) {
- return $this->db->limitResult( $sql, $this->limit, $this->offset );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+
+ return $dbr->limitResult( $sql, $this->limit, $this->offset );
}
/**
*/
function queryMain( $filteredTerm, $fulltext ) {
$match = $this->parseQuery( $filteredTerm, $fulltext );
- $page = $this->db->tableName( 'page' );
- $searchindex = $this->db->tableName( 'searchindex' );
+
+ $dbr = $this->lb->getMaintenanceConnectionRef( DB_REPLICA );
+ $page = $dbr->tableName( 'page' );
+ $searchindex = $dbr->tableName( 'searchindex' );
+
return 'SELECT page_id, page_namespace, page_title ' .
"FROM $page,$searchindex " .
'WHERE page_id=si_page AND ' . $match;
}
}
- $searchon = $this->db->addQuotes( ltrim( $searchon, ' &' ) );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $searchon = $dbr->addQuotes( ltrim( $searchon, ' &' ) );
$field = $this->getIndexField( $fulltext );
+
return " CONTAINS($field, $searchon, 1) > 0 ";
}
* @param string $text
*/
function update( $id, $title, $text ) {
- $dbw = wfGetDB( DB_MASTER );
+ $dbw = $this->lb->getConnection( DB_MASTER );
$dbw->replace( 'searchindex',
[ 'si_page' ],
[
* @param string $title
*/
function updateTitle( $id, $title ) {
- $dbw = wfGetDB( DB_MASTER );
-
+ $dbw = $this->lb->getConnectionRef( DB_MASTER );
$dbw->update( 'searchindex',
[ 'si_title' => $title ],
[ 'si_page' => $id ],