* @subpackage Search
*/
-require_once( 'SearchEngine.php' );
+require_once( 'SearchMySQL.php' );
-class SearchMySQL4 extends SearchEngine {
- var $strictMatching = false;
+/**
+ * @package MediaWiki
+ * @subpackage Search
+ */
+class SearchMySQL4 extends SearchMySQL {
+ var $strictMatching = true;
+ /** @todo document */
function SearchMySQL4( &$db ) {
$this->db =& $db;
}
-
- function getIndexField( $fulltext ) {
- return $fulltext ? 'si_text' : 'si_title';
- }
+ /** @todo document */
function parseQuery( $filteredText, $fulltext ) {
global $wgContLang;
$lc = SearchEngine::legalSearchChars();
$field = $this->getIndexField( $fulltext );
return " MATCH($field) AGAINST('$searchon' IN BOOLEAN MODE) ";
}
-
- function queryMain( $filteredTerm, $fulltext ) {
- $match = $this->parseQuery( $filteredTerm, $fulltext );
- $cur = $this->db->tableName( 'cur' );
- $searchindex = $this->db->tableName( 'searchindex' );
- return 'SELECT cur_id, cur_namespace, cur_title, cur_text ' .
- "FROM $cur,$searchindex " .
- 'WHERE cur_id=si_page AND ' . $match;
- }
-
- function update( $id, $title, $text ) {
- $dbw=& wfGetDB(DB_MASTER);
- $dbw->replace( 'searchindex', array(array('si_page')),
- array(
- 'si_page' => $id,
- 'si_title' => $dbw->strencode($title),
- 'si_text' => $dbw->strencode( $text )
- ), 'SearchMySQL4::update' );
- }
-
- function updateTitle($id,$title) {
- $dbw=& wfGetDB(DB_MASTER);
- $lowpri=$dbw->lowPriorityOption();
- $searchindex = $dbw->tableName( 'searchindex' );
-
- $sql = "UPDATE $lowpri $searchindex SET si_title='" .
- $dbw->strencode( $title ) .
- "' WHERE si_page={$id}";
-
- $dbw->query( $sql, "SearchMySQL4::updateTitle" );
- }
-
}
-
?>