Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filter "description" in /electioneering/ #5441

Closed
3 tasks
hcaofec opened this issue May 10, 2023 · 0 comments · Fixed by #5450
Closed
3 tasks

Fix filter "description" in /electioneering/ #5441

hcaofec opened this issue May 10, 2023 · 0 comments · Fixed by #5450
Assignees
Milestone

Comments

@hcaofec
Copy link
Contributor

hcaofec commented May 10, 2023

What we’re after

When filtering for description in /electioneering/, it does not filter correctly.

For example, when filtering for 'house', the backend query looks like this:

https://api.open.fec.gov/v1/electioneering/?description=house&per_page=20&sort_null_only=false&sort_nulls_last=false&page=1&api_key=DEMO_KEY&sort_hide_null=false

SELECT ofec_electioneering_mv.cmte_id, ofec_electioneering_mv.cmte_nm, ofec_electioneering_mv.cand_id, ofec_electioneering_mv.cand_name, ofec_electioneering_mv.cand_office, ofec_electioneering_mv.cand_office_district, ofec_electioneering_mv.cand_office_st, ofec_electioneering_mv.f9_begin_image_num, ofec_electioneering_mv.calculated_cand_share, ofec_electioneering_mv.comm_dt, ofec_electioneering_mv.pub_distrib_dt, ofec_electioneering_mv.disb_dt, ofec_electioneering_mv.reported_disb_amt, ofec_electioneering_mv.disb_desc, ofec_electioneering_mv.rpt_yr, ofec_electioneering_mv.file_num, ofec_electioneering_mv.amndt_ind, ofec_electioneering_mv.receipt_dt, ofec_electioneering_mv.election_tp, ofec_electioneering_mv.payee_nm, ofec_electioneering_mv.payee_st, ofec_electioneering_mv.idx, ofec_electioneering_mv.sb_image_num, ofec_electioneering_mv.sub_id, ofec_electioneering_mv.link_id, ofec_electioneering_mv.sb_link_id, ofec_electioneering_mv.number_of_candidates, ofec_electioneering_mv.pdf_url, ofec_electioneering_mv.purpose_description_text 
FROM ofec_electioneering_mv 
WHERE ofec_electioneering_mv.purpose_description_text @@ to_tsquery('h:*') OR ofec_electioneering_mv.purpose_description_text @@ to_tsquery('o:*') OR ofec_electioneering_mv.purpose_description_text @@ to_tsquery('u:*') OR ofec_electioneering_mv.purpose_description_text @@ to_tsquery('s:*') OR ofec_electioneering_mv.purpose_description_text @@ to_tsquery('e:*')

Action item(s)

  • Refactor api to have query look like ofec_electioneering_mv.purpose_description_text @@ to_tsquery('house:*')
  • Add test case

Completion criteria

  • Filter description works properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants