Add the Postgres slash search fix to existing installations.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 6 Sep 2007 16:42:58 +0000 (16:42 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 6 Sep 2007 16:42:58 +0000 (16:42 +0000)
RELEASE-NOTES
maintenance/postgres/archives/patch-ts2pagetitle.sql [new file with mode: 0644]
maintenance/updaters.inc

index e1aef60..ee9b0cf 100644 (file)
@@ -23,6 +23,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 === New features in 1.12 ===
 
 === Bug fixes in 1.12 ===
+* Subpages are now indexed for searching properly when using Postgres
 
 === API changes in 1.12 ===
 
diff --git a/maintenance/postgres/archives/patch-ts2pagetitle.sql b/maintenance/postgres/archives/patch-ts2pagetitle.sql
new file mode 100644 (file)
index 0000000..4ac985e
--- /dev/null
@@ -0,0 +1,13 @@
+CREATE OR REPLACE FUNCTION ts2_page_title()
+RETURNS TRIGGER
+LANGUAGE plpgsql AS
+$mw$
+BEGIN
+IF TG_OP = 'INSERT' THEN
+  NEW.titlevector = to_tsvector('default',REPLACE(NEW.page_title,'/',' '));
+ELSIF NEW.page_title != OLD.page_title THEN
+  NEW.titlevector := to_tsvector('default',REPLACE(NEW.page_title,'/',' '));
+END IF;
+RETURN NEW;
+END;
+$mw$;
index 3c97204..beadacf 100644 (file)
@@ -1526,5 +1526,9 @@ function do_postgres_updates() {
                dbsource($ni[2]);
        }
 
+       # Tweak the page_title tsearch2 trigger to filter out slashes
+       # This is create or replace, so harmless to call if not needed
+       dbsource(archive("patch-ts2pagetitle.sql"));
+
        return;
 }