-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: Add dashboard search filter support #112
Conversation
Codecov Report
@@ Coverage Diff @@
## master #112 +/- ##
==========================================
- Coverage 75.28% 74.76% -0.52%
==========================================
Files 17 18 +1
Lines 615 650 +35
Branches 77 85 +8
==========================================
+ Hits 463 486 +23
- Misses 127 135 +8
- Partials 25 29 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments and questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good refactoring! Left some comments.
search_service/api/filter.py
Outdated
""" | ||
Fetch search results based on the page_index, query_term, and | ||
search_request dictionary posted in the request JSON. | ||
:return: list of table results. List can be empty if query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about updating to: return json payload of schema
? Also, from the structure of this generic class, I don't think we can assume it's a list.
search_service/api/filter.py
Outdated
return {'message': msg}, HTTPStatus.BAD_REQUEST | ||
|
||
query_term = args.get('query_term') # type: str | ||
if ':' in query_term: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know this. Why we don't allow this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly due to colon is not allowed or needs to escape in doing query string filter.
search_service/api/filter.py
Outdated
from search_service.proxy import get_proxy_client | ||
|
||
|
||
class BaseFilterAPI(Resource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: how about separate this class into separate file? It just because this file would grow as we introduce more filterable resource.
schema: | ||
type: integer | ||
default: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm... Not sure what schema
with default value 0
is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy paste error, will clean up.
index: str = '') -> SearchTableResult: | ||
def fetch_search_results_with_filter(self, *, | ||
query_term: str, | ||
search_request: dict, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we validate if the key is filterable key? For example, if client sends some unknown key, how search service would react?
example: { 'bogus': ['mode'] }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we validate the search filter value inside the proxy https://github.com/lyft/amundsensearchlibrary/blob/master/search_service/proxy/elasticsearch.py#L365
@jinhyukchang @ttannis update the pr and test it on staging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the update!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous comments resolved
Summary of Changes
Tests
Add API test and change related backend tests.
Documentation
What documentation did you add or modify and why? Add any relevant links then remove this line
CheckList
Make sure you have checked all steps below to ensure a timely review.
make test