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.
fixed #350
Because encodeURIComponent doesn't encode single quote, when fqParam contains '. the value of the input is not properly constructed.
for example when fqParam = taxon_name%3A%22'Ochlerotatus'%20daliensis%22
<input type="checkbox" name="fqs" class="fqs" value="taxon_name%3A%22" ochlerotatus'%20daliensis%22'="">
The solution is, since encodeURIComponent encodes double quote, then fqParam already has double quotes escaped, use " to construct the value.
Did a test with the above fix.
Selected these fitlers (total 235 records expected)
Actual result record amount is correct.
And the URL is correct.
https://localhost:8080/ala-hub/occurrences/search?q=*:*&fq=(taxon_name:"'Ochlerotatus'" OR taxon_name:"'Ochlerotatus' ('Finlaya') britteni" OR taxon_name:"'Ochlerotatus' ('Finlaya') candidoscutellum" OR taxon_name:"'Ochlerotatus' ('Finlaya') monocellatus" OR taxon_name:"'Ochlerotatus' ('Finlaya') subauridorsum" OR taxon_name:"'Ochlerotatus' ('Finlaya') wasselli" OR taxon_name:"'Ochlerotatus' daliensis" OR taxon_name:"'Stolasterias")
Did another test which includes filters with both ' and ".
Result records amount is wrong because of https://github.com/AtlasOfLivingAustralia/biocache-service/issues/440 but constructed URL is correct.
https://localhost:8080/ala-hub/occurrences/search?q=*:*&fq=(taxon_name:""Cyclophora" lechriostropha" OR taxon_name:""Cyclophora" rhodobapta" OR taxon_name:""Cyclophora" sticta" OR taxon_name:"'Ochlerotatus'" OR taxon_name:"'Ochlerotatus' ('Finlaya') britteni" OR taxon_name:"'Ochlerotatus' ('Finlaya') candidoscutellum" OR taxon_name:"'Stolasterias")