Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION vrental_properties_ft_trigger() RETURNS trigger AS $$
- begin
- new.ft_index_col :=
- setweight(to_tsvector('pg_catalog.english', 'vr' || vrental_properties.id::TEXT ), 'D') ||
- setweight(to_tsvector('pg_catalog.english', vrental_properties.id::TEXT ), 'D') ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.property_phone,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.town,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.zip,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.bedrooms,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.bathrooms,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.title,''), 'A')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.map_nearby,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.directions,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.public_note,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.description,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.full_description,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.internet_description,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.additional_pricing_info,''), 'D')) ||
- setweight(to_tsvector('pg_catalog.english', coalesce(vrental_properties.additional_area_description,''), 'D'));
- return new;
- end
- $$ LANGUAGE plpgsql;
- 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