<commit_before>module Parted
  def indexable_content
    content = super
    latest_edition.parts.each do |part|
      content = "#{content} #{part.title} #{part.body}"
    end
    content.strip
  end

  def search_index
    output = super
    output['additional_links'] = []
    latest_edition.parts.each do |part|
      output['additional_links'] << {
        'title' => part.title,
        'link' => "#{Plek.current.find('frontend')}/#{slug}/#{part.slug}"
      }
    end
    output
  end
end<commit_msg>Don't blow up if a publication has no latest_edition.<commit_after>module Parted
  def indexable_content
    content = super
    return content unless latest_edition
    latest_edition.parts.each do |part|
      content = "#{content} #{part.title} #{part.body}"
    end
    content.strip
  end

  def search_index
    output = super
    output['additional_links'] = []
    latest_edition.parts.each do |part|
      output['additional_links'] << {
        'title' => part.title,
        'link' => "#{Plek.current.find('frontend')}/#{slug}/#{part.slug}"
      }
    end
    output
  end
end
{'fraction_non_alphanumeric': 0.13515981735159818, 'fraction_numerical': 0.0, 'mean_word_length': 2.832167832167832, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4185368', 'n_tokens_mistral': 355, 'n_tokens_neox': 355, 'n_words': 77}