From: Domas Mituzas Date: Thu, 2 Dec 2004 19:25:36 +0000 (+0000) Subject: unbreak full text search support / index updates on PostgreSQL X-Git-Tag: 1.5.0alpha1~1169 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=77a5b28598adff469c26db866c417a0a936a9f37;p=lhc%2Fweb%2Fwiklou.git unbreak full text search support / index updates on PostgreSQL --- diff --git a/includes/SearchTsearch2.php b/includes/SearchTsearch2.php index 53b9523442..4db9dfbdeb 100644 --- a/includes/SearchTsearch2.php +++ b/includes/SearchTsearch2.php @@ -80,6 +80,30 @@ class SearchTsearch2 extends SearchEngine { "FROM $cur,$searchindex " . 'WHERE cur_id=si_page AND ' . $match; } + + function update( $id, $title, $text ) { + $dbw=& wfGetDB(DB_MASTER); + $searchindex = $dbw->tableName( 'searchindex' ); + $sql = "DELETE FROM $searchindex WHERE si_page={$id}"; + $dbw->query($sql,"SearchTsearch2:update"); + $sql = "INSERT INTO $searchindex (si_page,si_title,si_text) ". + " VALUES ( $id, to_tsvector('". + $dbw->strencode($title). + "'),to_tsvector('". + $dbw->strencode( $text)."')) "; + $dbw->query($sql,"SearchTsearch2:update"); + } + + function updateTitle($id,$title) { + $dbw=& wfGetDB(DB_MASTER); + $searchindex = $dbw->tableName( 'searchindex' ); + $sql = "UPDATE $searchindex SET si_title=to_tsvector('" . + $db->strencode( $title ) . + "') WHERE si_page={$id}"; + + $dbw->query( $sql, "SearchMySQL4::updateTitle" ); + } + } ?>