diff --git a/src/super_archives/search_indexes.py b/src/super_archives/search_indexes.py
index 7c4820f..3a5e65b 100644
--- a/src/super_archives/search_indexes.py
+++ b/src/super_archives/search_indexes.py
@@ -12,12 +12,12 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
title = indexes.CharField(model_attr='latest_message__subject_clean')
description = indexes.CharField(use_template=True)
latest_description = indexes.CharField(
- model_attr='latest_message__body',
+ model_attr='latest_message__description',
indexed=False,
)
created = indexes.DateTimeField()
modified = indexes.DateTimeField(
- model_attr='latest_message__received_time'
+ model_attr='latest_message__modified'
)
tag = indexes.CharField(model_attr='mailinglist__name')
collaborators = indexes.CharField(use_template=True, stored=False)
@@ -33,12 +33,6 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
def get_updated_field(self):
return 'latest_message__received_time'
- def prepare_author(self, obj):
- from_address = obj.message_set.first().from_address
- if from_address.user:
- return from_address.user.username
- return None
-
def prepare_fullname(self, obj):
return obj.message_set.first().from_address.get_full_name()
@@ -52,6 +46,9 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
from_address.user.username,
)
+ def prepare_author(self, obj):
+ return obj.latest_message.author
+
def prepare_author_url(self, obj):
first_message = obj.message_set.first()
if first_message.from_address.user:
diff --git a/src/super_archives/templates/message-preview.html b/src/super_archives/templates/message-preview.html
index f9ffc0b..846ace6 100644
--- a/src/super_archives/templates/message-preview.html
+++ b/src/super_archives/templates/message-preview.html
@@ -11,7 +11,7 @@
{% endif %}
{% if result.title %}
-
+
{% if query %}
@@ -25,7 +25,16 @@
{% if result.description %}
- - {% if query %}{% highlight result.description with query max_length "150" %}{% else %}{{ result.description|truncatechars:150 }}{% endif %}
+ - {% if query %}
+ {% highlight result.description with query max_length "150" %}
+ {% else %}
+ {% if result.latest_description %}
+ {{ result.latest_description|escape|truncatechars:150 }}
+ {% elif result.description %}
+ {{ result.description|escape|truncatechars:150 }}
+ {% endif %}
+ {% endif %}
+
{% endif %}
{% if result.fullname or result.modified %}
--
libgit2 0.21.2