-
Notifications
You must be signed in to change notification settings - Fork 0
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 search API functionality #2
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This update replaces flask_restful with flask_restx in the app.py file. Furthermore, Search has been imported from resources and a new API endpoint has been created, which takes in coarse_record_type and location as parameters. This change enhances search capabilities of the application.
Added a new SearchQueryEngine middleware in search_query.py file. This engine allows for complex SQL queries and provides functionality for search queries based on record type and location. A logging mechanism for query results is also included enhancing search auditing and debugging.
Implemented a new Search resource leveraging the SearchQueryEngine middleware for user-driven search inquiries. The resource processes search terms based on record type and location, and includes a reinitializing feature for failed queries. Search results auditing and error reporting are also handled.
The PsycopgResource has been updated to utilize the flask-restx library instead of flask_restful. Additionally, the __init__ method has been altered to accept positional arguments and explicitly invoke the superclass's initialization method.
Two major code blocks in Search.py were refactored for improved readability. Changes were made to simplify the invocation of the quick_search method in the classes and the formatting of the error message string.
The code in 'search_query.py' has been refactored for better readability and simplicity. Function 'expand_params' and class 'SearchQueryEngine' have been revised, simplifying function signatures, removing verbose comments, and improving SQL structure to enhance maintainability.
The search and lemmatization functions in the search_query.py middleware were refactored for enhanced readability and improved performance. The process_search_term function was split into two separate functions - lemmatize and search_query. This allows the functions to have narrower scope and better separation of concerns. A 'quick_search' function also better handles the distinction between unaltered and lemmatized results. Additionally, minor improvements were done in logging query results, mitigating potential issues in cases of empty search parameters.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Description
Testing
Performance
Docs
Resource
.app.py
and navigate to server location. Then click on "Default namespace" to view the full docuemtnation for all methods.