You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The api search parameter supports single word queries, but not multiple words.
Ex:
curl --location --request GET 'http://localhost:8000/leads?search=legal' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluQGdtYWlsLmNvbSIsImV4cGlyZXMiOiIyMDIxLTA4LTI2VDAyOjQ2OjQyLjE2MzQ4MyswMDowMCIsImFkbWluIjp0cnVlfQ.NH5pOjfJ8f83XcYJmrJ3S-o2kkkbgmgX7C3R2mMHtBg'
returns 8 leads, but changing the search query parameter to veterans+legal
curl --location --request GET 'http://localhost:8000/leads?search=veterans+legal' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluQGdtYWlsLmNvbSIsImV4cGlyZXMiOiIyMDIxLTA4LTI2VDAyOjQ2OjQyLjE2MzQ4MyswMDowMCIsImFkbWluIjp0cnVlfQ.NH5pOjfJ8f83XcYJmrJ3S-o2kkkbgmgX7C3R2mMHtBg'
returns a 500 error
Suggested approach
In leads.py, modify the _parse_search_param function to convert a + delimited string of search terms to a tsquery string. The input string will be returned by request.args.get("search").
For example, the string "veterans+legal" should be converted to the string "to_tsquery('veterans & legal')"
Once _parse_search_param returns the right query, modify the sql queries in the the _get_all_leads function to account for the changes to the search variable.
The api search parameter supports single word queries, but not multiple words.
Ex:
returns 8 leads, but changing the
search
query parameter toveterans+legal
returns a 500 error
Suggested approach
In
leads.py
, modify the_parse_search_param
function to convert a+
delimited string of search terms to atsquery
string. The input string will be returned byrequest.args.get("search")
.For example, the string
"veterans+legal"
should be converted to the string"to_tsquery('veterans & legal')"
Once
_parse_search_param
returns the right query, modify the sql queries in the the_get_all_leads
function to account for the changes to thesearch
variable.Resources
postgres documentation on full text search
The text was updated successfully, but these errors were encountered: