search post urls too

pull/131/head
Aevann 2023-02-21 20:18:42 +02:00
parent 94d10fa274
commit c7d7de289f
1 changed files with 5 additions and 2 deletions

View File

@ -95,8 +95,11 @@ def searchposts(v:User):
words = [or_(Submission.title.ilike('%'+x+'%')) \
for x in criteria['q']]
else:
words = [or_(Submission.title.ilike('%'+x+'%'), Submission.body.ilike('%'+x+'%')) \
for x in criteria['q']]
words = [or_(
Submission.title.ilike('%'+x+'%'),
Submission.body.ilike('%'+x+'%'),
Submission.url.ilike('%'+x+'%'),
) for x in criteria['q']]
posts = posts.filter(*words)
if 'over18' in criteria: posts = posts.filter(Submission.over_18==True)