Skip to content

Commit

Permalink
update to_tsvector for fec_fitem_sched_a
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-upchurch committed Jun 14, 2019
1 parent 005246d commit c679150
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions data/migrations/V0136__redefine_fec_fitem_sched_b_insert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ END$$;


/*
The calculation of value for recipient_name_text in both public.ofec_sched_b and disclosure.fec_fitem_sched_b are slightly incorrect.
It should use clean_recipient_cmte_id instead of recipient_cmte_id.
redefine tsvector specification for fec_fitem_sched_b_insert
*/

CREATE OR REPLACE FUNCTION disclosure.fec_fitem_sched_b_insert()
Expand Down Expand Up @@ -189,3 +188,27 @@ CREATE INDEX ON ofec_committee_fulltext_audit_mv using gin(fulltxt);

GRANT ALL ON TABLE public.ofec_committee_fulltext_audit_mv TO fec;
GRANT SELECT ON TABLE public.ofec_committee_fulltext_audit_mv TO fec_read;


/*
update to_tsvector definition for fec_fitem_sched_a
*/
CREATE OR REPLACE FUNCTION disclosure.ju_fec_fitem_sched_a_insert()
RETURNS trigger AS
$BODY$
begin
new.pdf_url := image_pdf_url(new.image_num);
new.contributor_name_text := to_tsvector(concat(regexp_replace(new.contbr_nm, '[^a-zA-Z0-9]', ' ', 'g'), ' ', regexp_replace(new.clean_contbr_id, '[^a-zA-Z0-9]', ' ', 'g')));
new.contributor_employer_text := to_tsvector(regexp_replace(new.contbr_employer, '[^a-zA-Z0-9]', ' ', 'g'));
new.contributor_occupation_text := to_tsvector(regexp_replace(new.contbr_occupation, '[^a-zA-Z0-9]', ' ', 'g'));
new.is_individual := is_individual(new.contb_receipt_amt, new.receipt_tp, new.line_num, new.memo_cd, new.memo_text);
new.line_number_label := expand_line_number(new.filing_form, new.line_num);

return new;
end
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;

ALTER FUNCTION disclosure.ju_fec_fitem_sched_a_insert()
OWNER TO fec;

0 comments on commit c679150

Please sign in to comment.