[Live mode] Some live-mode queries result in SQL error
Opened this issue · 0 comments
Describe the bug
I run a dating app and use Placeholder to allow users to manually enter their location, or find a location to search. Sometimes users do interesting things, such as entering queries like this:
/parser/search?placetype=locality&mode=live&text=mostly+interested+in+ladys+living+in+and+around+the+southern+and+southwestern+suburbs+of+chicago
Obviously this is not an optimal placename search, but we can't control users. With live mode enabled, I get an HTML error message, even if I request accept: application/json
(seems to have no effect.)
SqliteError: near "JOIN": syntax error<br> at Database.prepare (/code/pelias/placeholder/node_modules/better-sqlite3/lib/methods/wrappers.js:5:21)<br> at TokenIndex.Database.prepare (/code/pelias/placeholder/lib/Database.js:36:32)<br> at TokenIndex.module.exports.matchSubjectObjectGeomIntersects (/code/pelias/placeholder/lib/Queries.js:171:12)<br> at /code/pelias/placeholder/prototype/query.js:65:15<br> at TokenIndex.module.exports._queryAll (/code/pelias/placeholder/lib/Queries.js:56:12)<br> at TokenIndex.module.exports.matchSubjectObject (/code/pelias/placeholder/lib/Queries.js:120:10)<br> at reduce (/code/pelias/placeholder/prototype/query.js:61:11)<br> at _queryGroup (/code/pelias/placeholder/prototype/query.js:88:3)<br> at Placeholder.<anonymous> (/code/pelias/placeholder/prototype/query.js:142:22)<br> at /code/pelias/placeholder/prototype/tokenize.js:15:12
If you turn off live mode, the result is actually pretty close to what the user desires, including Chicago as the first returned result.
Steps to Reproduce
As noted above, run the example query with live mode.
Expected behavior
There is no SQL error and the response is at least valid JSON, even if just an empty set.
Environment (please complete the following information):
Official docker image, version 3.12.0
.