From 44ef4bc551b6c386cef4d2b0be683c0d381dba46 Mon Sep 17 00:00:00 2001 From: TLSM Date: Sun, 20 Nov 2022 19:31:27 -0500 Subject: [PATCH] search: fix tsquery when quoted unstripped space. --- files/routes/search.py | 1 + 1 file changed, 1 insertion(+) diff --git a/files/routes/search.py b/files/routes/search.py index 2340dd0ba..6b848b525 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -217,6 +217,7 @@ def searchcomments(v): tokens = map(lambda x: re.sub(r'[\0():|&*!<>]', '', x), criteria['q']) tokens = filter(lambda x: len(x) > 0, tokens) tokens = map(lambda x: re.sub(r"'", "\\'", x), tokens) + tokens = map(lambda x: x.strip(), tokens) tokens = map(lambda x: re.sub(r'\s+', ' <-> ', x), tokens) comments = comments.filter(Comment.body_ts.match( ' & '.join(tokens),