From 99b6b356f05a61fc465031fd41cef0c1e506fa4a Mon Sep 17 00:00:00 2001 From: TLSM Date: Sun, 2 Oct 2022 15:50:05 -0400 Subject: [PATCH] Add comment search "quoted phrase" behavior. --- files/routes/search.py | 1 + 1 file changed, 1 insertion(+) diff --git a/files/routes/search.py b/files/routes/search.py index abba33961..a3d1266da 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -208,6 +208,7 @@ def searchcomments(v): if 'q' in criteria: tokens = map(lambda x: re.sub(r'[\0():|&*!]', '', x), criteria['q']) + tokens = map(lambda x: re.sub(r'\s+', ' <-> ', x), tokens) comments = comments.filter(Comment.body_ts.match( ' & '.join(tokens), postgresql_regconfig='english'))