X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/80e81e8ba3e132d6b51a0bb4c794d8f2c1f600d9..36d8ccc491b157c00e38a8f3192d47b7ead19964:/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 ddc48a1..5d5d9b8 100644 --- a/forum_modules/pgfulltext/pg_fts_install.sql +++ b/forum_modules/pgfulltext/pg_fts_install.sql @@ -59,10 +59,10 @@ begin setweight(to_tsvector('english', coalesce(body,'')), 'C') INTO doc FROM forum_node WHERE id = root_id; - SELECT count(*)::int INTO rcount FROM forum_node WHERE abs_parent_id = root_id AND deleted_id IS NULL; + SELECT count(*)::int INTO rcount FROM forum_node WHERE abs_parent_id = root_id AND (NOT state_string LIKE '%%deleted%%'); IF rcount > 0 THEN - FOR cv in SELECT setweight(to_tsvector('english', coalesce(body,'')), 'C') FROM forum_node WHERE abs_parent_id = root_id AND deleted_id IS NULL LOOP + FOR cv in SELECT setweight(to_tsvector('english', coalesce(body,'')), 'C') FROM forum_node WHERE abs_parent_id = root_id AND (NOT state_string LIKE '%%deleted%%') LOOP doc :=(doc || cv); END LOOP; END IF; @@ -105,4 +105,15 @@ select case when public.doc_table_exists()=0 then public.build_doc_table()end; drop function build_doc_table(); drop function doc_table_exists(); +CREATE OR REPLACE FUNCTION rank_exact_matches(rank float) RETURNS float AS $$ +begin + IF rank = 0 THEN + return 1; + ELSE + return rank; + END IF; + +end +$$ LANGUAGE plpgsql; + UPDATE forum_noderevision SET id = id WHERE TRUE;