Improve index and update tests
This commit is contained in:
parent
d519d2d2c8
commit
2ba799eb08
|
@ -54,7 +54,8 @@ class PostIndex(get_index_base()):
|
|||
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():
|
||||
|
|
|
@ -22,7 +22,7 @@ class PluginIndexingTests(BaseTest):
|
|||
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'])
|
||||
|
||||
|
@ -36,7 +36,7 @@ class PluginIndexingTests(BaseTest):
|
|||
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'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue