fix search

merge-requests/3/head
bug_creator 3 years ago
parent 066ea6b6d3
commit 15c7617a7d

@ -253,9 +253,13 @@ def query(content):
flash("Search content cannot be empty.")
return render_template('querypost.html')
search_result = "%" + inf + "%"
result = Post.query.filter(or_(Post.title.like(search_result), Post.body.like(search_result)))
print(search_result)
# result = Post.query.filter(or_(Post.title.like(search_result), Post.body.like(search_result)))
result = Post.query.filter(Post.body.like(search_result))
for item in result:
item.important = 0
if(item.title is None):
item.title=""
sentence = item.title + item.body
counts = 0
list1 = sentence.split(" ")

@ -69,14 +69,16 @@
<div class="tab-pane active" id="panel-1">
<ul class="posts list-unstyled">
{% for post in combination %}
{% include 'Posts/_postsInQuery.html' %}
{# {% include 'Posts/_postsInQuery.html' %}#}
{% include 'Posts/_posts.html' %}
{% endfor %}
</ul>
</div>
<div class="tab-pane" id="panel-2">
<ul class="posts list-unstyled">
{% for post in newest %}
{% include 'Posts/_postsInQuery.html' %}
{# {% include 'Posts/_postsInQuery.html' %}#}
{% include 'Posts/_posts.html' %}
{% endfor %}
</ul>
</div>
@ -84,7 +86,8 @@
<div class="tab-pane" id="panel-3">
<ul class="posts list-unstyled">
{% for post in hottest %}
{% include 'Posts/_postsInQuery.html' %}
{# {% include 'Posts/_postsInQuery.html' %}#}
{% include 'Posts/_posts.html' %}
{% endfor %}
</ul>
</div>
@ -92,7 +95,8 @@
<div class="tab-pane" id="panel-4">
<ul class="posts list-unstyled">
{% for post in relevance %}
{% include 'Posts/_postsInQuery.html' %}
{# {% include 'Posts/_postsInQuery.html' %}#}
{% include 'Posts/_posts.html' %}
{% endfor %}
</ul>
</div>

Binary file not shown.
Loading…
Cancel
Save