Remove special characters from search query.

remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-10-02 07:42:42 -04:00
parent 3bf62c6ff0
commit 0dfa4525fa
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 2 additions and 1 deletions

View File

@ -207,8 +207,9 @@ def searchcomments(v):
else: comments = comments.filter(Comment.author_id == author.id)
if 'q' in criteria:
tokens = map(lambda x: re.sub(r'[\0():|&*!]', '', x), criteria['q'])
comments = comments.filter(Comment.body_ts.match(
' & '.join(criteria['q']),
' & '.join(tokens),
postgresql_regconfig='english'))
if 'over18' in criteria: comments = comments.filter(Comment.over_18 == True)