require "formatters/abstract_indexable_formatter"

class ManualIndexableFormatter < AbstractIndexableFormatter
  def type
    "manual"
  end

private
  def indexable_content
    entity.summary # Manuals don't have a body
  end

  def organisation_slugs
    [entity.organisation_slug]
  end
end

require "formatters/abstract_indexable_formatter"

class ManualIndexableFormatter < AbstractIndexableFormatter
  def type
    "manual"
  end

private
  def extra_attributes
    {
      specialist_sectors: specialist_sectors
    }
  end

  def indexable_content
    entity.summary # Manuals don't have a body
  end

  def organisation_slugs
    [entity.organisation_slug]
  end

  def specialist_sectors
    entity.tags.select { |t| t[:type] == "specialist_sector" }.map { |t| t[:slug] }
  end
end

Send specialist sectors to Rummager for Manuals
Send specialist sectors to Rummager for Manuals

In order to list Manuals on Topic pages for Specialist Sectors we need
to send these to Rummager. We do this by pulling out the Specialist
Sector tags when formatting the Manual for indexing and merging it into
the `indexable_attributes` provided by the `AbstractIndexableFormatter`.
