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

Simple change #220

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

silkylaroux
Copy link
Collaborator

Description

Thought i needed to replace a '+' but instead need to replace a space. Oops. Not tested with the frontend, but should work to now search multiple terms.

Fixes #95

Type of Change:

  • Code

Code/Quality Assurance Only

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Ran some a few sample curl commands like this:
curl --location --request GET 'http://localhost:8000/leads?search=Community+Denver+ministry' --header "Authorization: Bearer ..."

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged

Code/Quality Assurance Only

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downstream modules

Thought i needed to replace a '+' but instead need to replace a space. Oops. Not tested with the frontend, but should work.
@galbwe galbwe self-requested a review October 27, 2021 02:27
@@ -320,7 +320,8 @@ def leads_number_of_pages():

def _parse_search_param(request):

return request.args.get("search")
multi_term_fix = request.args.get("search").replace(" ", "&")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This errors when "search" is not provided in the query string.

What happens is request.args.get("serach") evaluates to None, and then since None has no replace method an AttributeError gets raised.

Testing from the frontend, this happens when the search bar is empty.

Copy link
Collaborator

@galbwe galbwe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to account for the case where "search" is not passed as a query parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multiple search terms in api full text search
2 participants