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.
Description
This PR fixes several issues with the search:
data
parameter for query parameters instead of manually inserting them in the URLdata
parameter, the query parameters get correctly encoded, e.g.&
becomes%26
foo&bar
needs to befoo%26bar
, otherwise it's interpreted as a separator''''' | foo
becomesfoo:*
)Known issues:
Single-quotes might mess with the query, but the original implementation didn't really deal with them either, so left it as it is (aside from fixing some of the errors caused by
'
s.)Context
Using
&
in a search query causes an error. Found other issues while investigating this, e.g. some part of the code was unreachable,foo|bar
was interpreted as is (becomingfoo|bar:*
in the SQL), butfoo| bar
,foo |bar
andfoo | bar
would turn into ANDs (becomingfoo & bar:*
)PL-38
How Has This Been Tested?
Unit tests.
Manual Testing Instructions for Reviewers
You can test it through the API with different queries, e.g. http://localhost:8000/v2/search/?q=a%26b