diff --git a/app/services/search/feed_content.rb b/app/services/search/feed_content.rb index 114e27a9d..f473e3e0c 100644 --- a/app/services/search/feed_content.rb +++ b/app/services/search/feed_content.rb @@ -29,6 +29,11 @@ module Search source["user_id"] = source.dig("user", "id") source["highlight"] = hit["highlight"] source["readable_publish_date"] = source["readable_publish_date_string"] + source["podcast"] = { + "slug" => source["slug"], + "image_url" => source["main_image"], + "title" => source["title"] + } source.merge(timestamps_hash(hit)) end diff --git a/app/services/search/query_builders/feed_content.rb b/app/services/search/query_builders/feed_content.rb index 2b6bcec38..af08a5a17 100644 --- a/app/services/search/query_builders/feed_content.rb +++ b/app/services/search/query_builders/feed_content.rb @@ -39,17 +39,19 @@ module Search SOURCE = %i[ id - title - path class_name comments_count - tags - readable_publish_date_string - positive_reactions_count flare_tag_hash - user - reading_time + main_image + path + positive_reactions_count published_at + readable_publish_date_string + reading_time + slug + tags + title + user ].freeze attr_accessor :params, :body diff --git a/spec/services/search/feed_content_spec.rb b/spec/services/search/feed_content_spec.rb index 950560717..ba515db08 100644 --- a/spec/services/search/feed_content_spec.rb +++ b/spec/services/search/feed_content_spec.rb @@ -38,12 +38,14 @@ RSpec.describe Search::FeedContent, type: :service do ] flare_tag_keys = %w[name bg_color_hex text_color_hex] user_keys = %w[username name profile_image_90] + podcast_keys = %w[slug image_url title] index_documents([article1]) feed_doc = described_class.search_documents(params: { size: 1 }).first expect(feed_doc.keys).to include(*view_keys) expect(feed_doc["user"].keys).to include(*user_keys) expect(feed_doc["flare_tag"].keys).to include(*flare_tag_keys) + expect(feed_doc["podcast"].keys).to include(*podcast_keys) end context "with a query" do