# HG changeset patch # User neko259 # Date 2014-07-02 09:44:48 # Node ID 7b9eaa2989a44ab1b96e5df6fc8e58ea910ffffc # Parent 01fee5e08b51d467a5f2720a202492cf1a263af9 Use post id in search. Speed up post viewing diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -322,7 +322,10 @@ class Post(models.Model, Viewable): else: can_bump = thread.can_bump() - opening_post_id = thread.get_opening_post_id() + if is_opening: + opening_post_id = self.id + else: + opening_post_id = thread.get_opening_post_id() return render_to_string('boards/post.html', { 'post': self, diff --git a/boards/templates/search/indexes/boards/post_text.txt b/boards/templates/search/indexes/boards/post_text.txt --- a/boards/templates/search/indexes/boards/post_text.txt +++ b/boards/templates/search/indexes/boards/post_text.txt @@ -1,2 +1,3 @@ {{ object.title }} -{{ object.text }} \ No newline at end of file +{{ object.text }} +{{ object.id }} \ No newline at end of file diff --git a/boards/templates/search/search.html b/boards/templates/search/search.html --- a/boards/templates/search/search.html +++ b/boards/templates/search/search.html @@ -26,8 +26,6 @@ {% for result in page.object_list %} {{ result.object.get_view }} - {% empty %} -
{% trans 'No results found.' %}
{% endfor %} {% if page.has_next %}