Skip to content

Commit

Permalink
Improve index and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Federighi committed Oct 16, 2015
1 parent bc12b6e commit 3eb9937
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion djangocms_blog/search_indexes.py
Expand Up @@ -54,7 +54,8 @@ def get_model(self):
def get_search_data(self, post, language, request):
optional_attributes = []
abstract = post.safe_translation_getter('abstract')
text_bits = [strip_tags(abstract)]
text_bits = [post.get_title()]
text_bits.append(strip_tags(abstract))
text_bits.append(post.get_description())
#text_bits.append(' '.join(post.get_keywords()))
for category in post.categories.all():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_search.py
Expand Up @@ -22,7 +22,7 @@ def test_blog_post_is_indexed_using_prepare(self):
print(indexed)
self.assertEqual(post.get_title(), indexed['title'])
self.assertEqual(post.get_description(), indexed['description'])
self.assertEqual('First post first line This is the description category 1', indexed['text'])
self.assertEqual('First post First post first line This is the description category 1', indexed['text'])
self.assertEqual(post.get_absolute_url(), indexed['url'])
self.assertEqual(post.date_published.strftime("%Y-%m-%d %H:%M:%S"), indexed['pub_date'])

Expand All @@ -36,7 +36,7 @@ def test_blog_post_is_indexed_using_update_object(self):
print(indexed)
self.assertEqual(post.get_title(), indexed['title'])
self.assertEqual(post.get_description(), indexed['description'])
self.assertEqual('First post first line This is the description category 1', indexed['text'])
self.assertEqual('First post First post first line This is the description category 1', indexed['text'])
self.assertEqual(post.get_absolute_url(), indexed['url'])
self.assertEqual(post.date_published.strftime("%Y-%m-%d %H:%M:%S"), indexed['pub_date'])

0 comments on commit 3eb9937

Please sign in to comment.