diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-08-20 11:19:42 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-08-20 11:24:20 +0200 |
commit | 13c1fa8e54b8a02854a0b15a19d54e0efa4968d6 (patch) | |
tree | 7895d362fd8d57a006fddd2be2c14536e5a62c2c /server.js | |
parent | c59ca4f0efe17213a6ba3a0f14cf3f525bf12ff6 (diff) | |
download | server-13c1fa8e54b8a02854a0b15a19d54e0efa4968d6.tar.gz |
Try verbatim search if FTS search syntax is invalid.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1104,8 +1104,13 @@ app.post("/forum/reply/:thread_id", must_be_logged_in, function (req, res) { app.get("/forum/search", must_be_logged_in, function (req, res) { let search = req.query.q let results = [] - if (search) - results = FORUM_SEARCH.all(search) + if (search) { + try { + results = FORUM_SEARCH.all(search) + } catch (err) { + results = FORUM_SEARCH.all('"' + search.replaceAll('"', '""') + '"') + } + } res.render("forum_search.pug", { user: req.user, search, results }) }) |