-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add exclusion argument ("exclude") capability to API #2897
Comments
Here is the sqlalchemy syntax, for conjunctions like "not" In this case we would want to extend the filter multi field to parse out arguments that started with "-" we would then want those arguments to be in the exclusion kwargs and the other args to be processed as normal. This is a common convention and also how we build exclusion queries in the legal endpoints I think this will be relatively easy to add to the filter and filter multi fields, I know this is also a sought after feature for the filter text fields as well. |
The code in the views is ultimately calling methods defined in Using the I'm not sure whether or not we want to incorporate any exclude functionality in these methods directly or write separate exclude methods that we could chain just like the existing filters, but either option will likely get us the result we want! Now it's just a matter of figuring out how to denote when something should be excluded instead of filtered by, and @LindsayYoung's suggestion of adding a |
Thinking through this a bit more, I think we'd be okay modifying the existing methods and performing the checks for a presence of |
@LindsayYoung Just to answer your question about the elastic search exclude argument does use a |
😆 great minds think alike, I brought the same thing up with @LindsayYoung about the confusion, @patphongs. :-) It is generally standard practice (and not just with Elasticsearch) to use My main concern was folks being confused looking at the URL as the |
Merged, so closing. Thanks! |
The capability of adding an exclusion argument to an API call would help build on functionality in which we need to exclude specific data from the call. This is especially pertinent to the RFAIs committee filings issue, https://github.com/18F/fec-cms/issues/1663, which would allow the call to exclude specific RFAIs and segment them out to particular tables.
@LindsayYoung suggested that exclusions could be built within the views.py as an additional funcitonality. Code reference below:
https://github.com/18F/openFEC/blob/8e39a1f8e04915ade2e97898b96eda2ea686e906/webservices/common/views.py#L44
filter_match
,filter_multi
, andfilter_fulltext
type filter options. Pay special attention to combo include/exclude forfulltext
searches. Consider taking inventory of which endpoints use these 3 sets of filtersThe text was updated successfully, but these errors were encountered: