diff --git a/app/main/views.py b/app/main/views.py index ff4c41d..fd0a298 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -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(" ") diff --git a/app/templates/querypost.html b/app/templates/querypost.html index f0bed2c..faf520c 100644 --- a/app/templates/querypost.html +++ b/app/templates/querypost.html @@ -69,14 +69,16 @@
@@ -84,7 +86,8 @@
@@ -92,7 +95,8 @@
diff --git a/data-dev.sqlite b/data-dev.sqlite index d0bb7ab..9793764 100644 Binary files a/data-dev.sqlite and b/data-dev.sqlite differ