Don't index old versions via tsearch2
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Sun, 14 Jan 2007 22:57:31 +0000 (22:57 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Sun, 14 Jan 2007 22:57:31 +0000 (22:57 +0000)
includes/SearchPostgres.php

index 457636b..c202f91 100644 (file)
@@ -124,7 +124,15 @@ class SearchPostgres extends SearchEngine {
 
        ## These two functions are done automatically via triggers
 
-       function update( $id, $title, $text ) { return true; }
+       function update( $pageid, $title, $text ) {
+               $dbw =& wfGetDB( DB_MASTER );
+               ## We don't want to index older revisions
+               $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id = ".
+                               "(SELECT rev_text_id FROM revision WHERE rev_page = $pageid ".
+                               "ORDER BY rev_text_id DESC LIMIT 1 OFFSET 1)";
+               $dbw->doQuery($SQL);
+               return true;
+       }
     function updateTitle( $id, $title )   { return true; }
 
 } ## end of the SearchPostgres class