Guest User

Untitled

a guest
Dec 14th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE FUNCTION vrental_properties_ft_trigger() RETURNS trigger AS $$
  2. begin
  3.     new.ft_index_col :=
  4.         setweight(to_tsvector('pg_catalog.english', 'vr' || vrental_properties.id::TEXT ), 'D') ||
  5.         setweight(to_tsvector('pg_catalog.english', vrental_properties.id::TEXT ), 'D') ||
  6.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.property_phone,''), 'D')) ||
  7.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.town,''), 'D')) ||
  8.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.zip,''), 'D')) ||
  9.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.bedrooms,''), 'D')) ||
  10.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.bathrooms,''), 'D')) ||
  11.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.title,''), 'A')) ||
  12.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.map_nearby,''), 'D')) ||
  13.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.directions,''), 'D')) ||
  14.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.public_note,''), 'D')) ||
  15.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.description,''), 'D')) ||
  16.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.full_description,''), 'D')) ||
  17.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.internet_description,''), 'D')) ||
  18.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.additional_pricing_info,''), 'D')) ||
  19.         setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.additional_area_description,''), 'D'));
  20.     return new;
  21. end
  22. $$ LANGUAGE plpgsql;
  23. CREATE TRIGGER vr_ft_update_trigger BEFORE INSERT OR UPDATE ON main.vrental_properties FOR EACH ROW EXECUTE PROCEDURE vrental_properties_ft_trigger();
Add Comment
Please, Sign In to add comment