-
Notifications
You must be signed in to change notification settings - Fork 106
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
/rad-analyst/ doesn't filter by analyst title or email #3699
Comments
From rad_analyst = {
'committee_id': fields.List(IStr, description=docs.COMMITTEE_ID),
'analyst_id': fields.List(fields.Int(), description='ID of RAD analyst'),
'analyst_short_id': fields.List(fields.Int(), description='Short ID of RAD analyst'),
'telephone_ext': fields.List(fields.Int(), description='Telephone extension of RAD analyst'),
'name': fields.List(fields.Str, description='Name of RAD analyst'),
'email': fields.List(fields.Str, description='Email of RAD analyst'),
'title': fields.List(fields.Str, description='Title of RAD analyst'),
'min_assignment_update_date': fields.Date(description='Filter results for assignment updates made after this date'),
'max_assignment_update_date': fields.Date(description='Filter results for assignment updates made before this date')
} From class RadAnalystView(ApiResource):
model = models.RadAnalyst
schema = schemas.RadAnalystSchema
page_schema = schemas.RadAnalystPageSchema
filter_fulltext_fields = [
('name', model.name_txt),
('analyst_email', model.analyst_email),
('analyst_title', model.analyst_title),
]
... |
Initial api (non-local) test with swagger ui:
[edited to specify non-local test] |
initial test of
[edited format] |
changed resource to match |
[reopened ticket that was incorrectly closed] |
potential similar issue related to |
in def filter_fulltext(query, kwargs, fields):
from sqlalchemy.dialects import postgresql
print('\nquery in\n')
print(str(query.statement.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True})))
print('\n')
for key, column in fields:
if kwargs.get(key):
exclude_list = build_exclude_list(kwargs.get(key))
include_list = build_include_list(kwargs.get(key))
if exclude_list:
filters = [
sa.not_(column.match(utils.parse_fulltext(value)))
for value in exclude_list
]
query = query.filter(sa.and_(*filters))
if include_list:
filters = [
column.match(utils.parse_fulltext(value))
for value in include_list
]
query = query.filter(sa.or_(*filters))
print('\nquery out\n')
print(str(query.statement.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True})))
print('\n')
return query The WHERE public.ofec_rad_analyst_vw.analyst_email @@ to_tsquery(<analyst usr>:* & fec:* & gov:*') From Next step: look at the |
Moved |
Tested various combinations of |
/rad-analyst/ doesn't filter by analyst title or email
Example: https://api.open.fec.gov/v1/rad-analyst/?sort_nulls_last=false&page=1&api_key=DEMO_KEY&sort_hide_null=false&sort_null_only=false&per_page=20&title=superstar
This is because args.py doesn't match the filters in the resource. It's probably most user friendly to update the resource file to match args.
The text was updated successfully, but these errors were encountered: