protected function doSearchTitleInDB( $term ) {
$q = $this->searchQuery( $term, 'titlevector', 'page_title' );
$olderror = error_reporting( E_ERROR );
- $resultSet = $this->db->query( $q, 'SearchPostgres', true );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $resultSet = $dbr->query( $q, 'SearchPostgres', true );
error_reporting( $olderror );
return new SqlSearchResultSet( $resultSet, $this->searchTerms );
}
protected function doSearchTextInDB( $term ) {
$q = $this->searchQuery( $term, 'textvector', 'old_text' );
$olderror = error_reporting( E_ERROR );
- $resultSet = $this->db->query( $q, 'SearchPostgres', true );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $resultSet = $dbr->query( $q, 'SearchPostgres', true );
error_reporting( $olderror );
return new SqlSearchResultSet( $resultSet, $this->searchTerms );
}
$searchstring = preg_replace( '/^[\'"](.*)[\'"]$/', "$1", $searchstring );
# # Quote the whole thing
- $searchstring = $this->db->addQuotes( $searchstring );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $searchstring = $dbr->addQuotes( $searchstring );
wfDebug( "parseQuery returned: $searchstring \n" );
# # We need a separate query here so gin does not complain about empty searches
$sql = "SELECT to_tsquery($searchstring)";
- $res = $this->db->query( $sql );
+ $dbr = $this->lb->getConnectionRef( DB_REPLICA );
+ $res = $dbr->query( $sql );
if ( !$res ) {
# # TODO: Better output (example to catch: one 'two)
die( "Sorry, that was not a valid search string. Please go back and try again" );
if ( count( $this->namespaces ) < 1 ) {
$query .= ' AND page_namespace = 0';
} else {
- $namespaces = $this->db->makeList( $this->namespaces );
+ $namespaces = $dbr->makeList( $this->namespaces );
$query .= " AND page_namespace IN ($namespaces)";
}
}
$query .= " ORDER BY score DESC, page_id DESC";
- $query .= $this->db->limitResult( '', $this->limit, $this->offset );
+ $query .= $dbr->limitResult( '', $this->limit, $this->offset );
wfDebug( "searchQuery returned: $query \n" );
" AND s.slot_role_id = " . $slotRoleStore->getId( SlotRecord::MAIN ) . " " .
" AND c.content_id = s.slot_content_id " .
" ORDER BY old_rev_text_id DESC OFFSET 1)";
- $this->db->query( $sql );
+
+ $dbw = $this->lb->getConnectionRef( DB_MASTER );
+ $dbw->query( $sql );
+
return true;
}
function updateTitle( $id, $title ) {
return true;
}
-
}