X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/178a88bfeb53a6b9520c74c10eea42073098902b..refs/heads/master:/forum_modules/pgfulltext/pg_fts_install.sql

diff --git a/forum_modules/pgfulltext/pg_fts_install.sql b/forum_modules/pgfulltext/pg_fts_install.sql
index 5d5d9b8..c046870 100644
--- a/forum_modules/pgfulltext/pg_fts_install.sql
+++ b/forum_modules/pgfulltext/pg_fts_install.sql
@@ -116,4 +116,14 @@ begin
 end
 $$ LANGUAGE plpgsql;
 
-UPDATE forum_noderevision SET id = id WHERE TRUE;
+CREATE OR REPLACE FUNCTION public.rebuild_index() RETURNS VOID as $$
+	DECLARE
+		r integer;
+	BEGIN
+		FOR r IN SELECT active_revision_id FROM forum_node WHERE node_type = 'question' LOOP
+			UPDATE forum_noderevision SET id = id WHERE id = r;
+		END LOOP;
+	END
+$$ LANGUAGE 'plpgsql';
+
+SELECT rebuild_index();
