Add comment search "quoted phrase" behavior.

master
Snakes 2022-10-02 15:50:05 -04:00
parent e05b1197c6
commit 99b6b356f0
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 1 additions and 0 deletions

View File

@ -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'))