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

AO keyword filter query exclude not working #6600

Open
patphongs opened this issue Dec 16, 2024 · 1 comment
Open

AO keyword filter query exclude not working #6600

patphongs opened this issue Dec 16, 2024 · 1 comment
Assignees
Milestone

Comments

@patphongs
Copy link
Member

patphongs commented Dec 16, 2024

Summary

When using the query exclude functionality, the user types - in front of the term they want to exclude. For example: -committee

Those excludes need to go into a separate query parameter called q_exclude. Regular query statements go into the query parameter q.

We have a python function called parse_query that will parse the exclude params for the more keyword options box, but need something similar for the AO JS API fetch calls.

Example correct API call:
https://api.open.fec.gov/v1/legal/search?ao_doc_category_id=F&type=advisory_opinions&hits_returned=20&from_hit=0&q=nevada&q_exclude=committee&api_key=DEMO_KEY

Example incorrect API call:
https://fec-dev-api.app.cloud.gov/v1/legal/search/?api_key=&type=advisory_opinions&ao_citation_require_all=false&ao_doc_category_id=F&sort=-ao_no&q=nevada+-committee

Frequency

We just recently noticed this bug with AO search filters after we made the template upgrades

Notes, steps, considerations

  • From the query string, look for the negation dash/hyphen, parse it into q_exclude

window.location like ?search_type=adrs&search=committee+-travel+-authorization

Fetch like ?type=adrs&hits_returned=20&from_hit=0&q=&q_exclude=travel+authorization

split on +- or %20-

(+-(travel+authorization) shouldn't be an issue)

How to Reproduce

  1. Go to the AO search
  2. In the Search keywords text box, type nevada -committee. This is doing a search for the word nevada and excluding the term committee. The query is sent without pushing committee into a separate query param q_exclude.
@patphongs patphongs added the Bug label Dec 16, 2024
@patphongs patphongs moved this to 🔨 Pre-refinement in Website project Dec 16, 2024
@patphongs patphongs added this to the 27.2 milestone Dec 16, 2024
@rfultz
Copy link
Contributor

rfultz commented Dec 16, 2024

What if a user tries term1 -(term2 term3) or term1 -"word1 word2"?

@rfultz rfultz self-assigned this Dec 19, 2024
@rfultz rfultz moved this from 🔨 Pre-refinement to 📥 Assigned in Website project Dec 19, 2024
@rfultz rfultz moved this from 📥 Assigned to 🏗 In Progress in Website project Jan 3, 2025
@rfultz rfultz modified the milestones: 27.2, 27.3 Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In Progress
Development

No branches or pull requests

2 participants