2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-10 01:41:25 +08:00
|
|
|
class SearchPostSerializer < BasicPostSerializer
|
2017-05-31 08:53:12 +08:00
|
|
|
has_one :topic, serializer: SearchTopicListItemSerializer
|
2014-09-02 17:15:08 +08:00
|
|
|
|
2020-08-07 12:43:09 +08:00
|
|
|
attributes :like_count, :blurb, :post_number, :topic_title_headline
|
|
|
|
|
|
|
|
def include_topic_title_headline?
|
|
|
|
if SiteSetting.use_pg_headlines_for_excerpt
|
|
|
|
object.topic_title_headline.present?
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def topic_title_headline
|
|
|
|
object.topic_title_headline
|
|
|
|
end
|
2015-09-18 15:16:10 +08:00
|
|
|
|
2014-09-02 17:15:08 +08:00
|
|
|
def blurb
|
|
|
|
options[:result].blurb(object)
|
|
|
|
end
|
2019-03-20 14:38:14 +08:00
|
|
|
|
|
|
|
def include_cooked?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_ignored?
|
|
|
|
false
|
|
|
|
end
|
2014-09-02 17:15:08 +08:00
|
|
|
end
|