Canadian-Geospatial-Platform / semantic-search-demo

Semantic Search API demo web page with optional user feedback
https://canadian-geospatial-platform.github.io/semantic-search-demo/
Other
1 stars 0 forks source link

Quotes break search #2

Open jvanulde opened 1 month ago

jvanulde commented 1 month ago

Tried searching with the following string:

silt "fraser river" delta

Error returned:

Error: SyntaxError: Bad escaped character in JSON at position 111 (line 1 column 112)

xinli-cai commented 1 month ago

After @anthonyfok's investigation, the error is possibly due to AWS API Gateway does not accept " in the query.

Anthony also noticed https://app.geo.ca/ frontend filters out any " and ' altogether, and we might just expose the problem through the demo. For example, try the query Indigenous people's culture, and you'll see keyword search failing with a different error.

Solutions: 1) Fix the '' and ' escape from https://app.geo.ca/ frontent 2) Perfom query sanitization not just on the frontend but also on the backend if feasible FYI @bo-lu @PVautour