forked from MarseyWorld/MarseyWorld
expand post searching to include bodies (instead of titles only)
parent
53a8818f80
commit
74a5ea88ac
|
@ -89,8 +89,8 @@ def searchposts(v):
|
|||
if 'q' in criteria:
|
||||
words=criteria['q'].split()
|
||||
words = criteria['q'].replace('\\', '').replace('_', '\_').replace('%', '\%').strip().split()
|
||||
words=[Submission.title.ilike('%'+x+'%') for x in words]
|
||||
posts=posts.filter(*words)
|
||||
words = [or_(Submission.title.ilike('%'+x+'%'), Submission.body.ilike('%'+x+'%')) for x in words]
|
||||
posts = posts.filter(*words)
|
||||
|
||||
if 'over18' in criteria: posts = posts.filter(Submission.over_18==True)
|
||||
|
||||
|
@ -287,4 +287,4 @@ def searchusers(v):
|
|||
users=users[:25]
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in users]}
|
||||
return render_template("search_users.html", v=v, query=query, total=total, page=page, users=users, sort=sort, t=t, next_exists=next_exists)
|
||||
return render_template("search_users.html", v=v, query=query, total=total, page=page, users=users, sort=sort, t=t, next_exists=next_exists)
|
||||
|
|
Loading…
Reference in New Issue