From 77a5b28598adff469c26db866c417a0a936a9f37 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Thu, 2 Dec 2004 19:25:36 +0000 Subject: [PATCH] unbreak full text search support / index updates on PostgreSQL --- includes/SearchTsearch2.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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" ); + } + } ?> -- 2.20.1