<commit_before>namespace :rummager do
  desc "index all published documents in rummager"
  task index: :environment do
    Guide.all.each do |guide|
      puts "Indexing #{guide.title}..."

      GuideSearchIndexer.new(guide).index
    end
  end

  desc "A temporary task to delete some unpublished documents from rummager " \
    "which failed due to a bug"
  task delete_failed: :environment do
    guide_slugs = %w(
      /service-manual/agile-delivery/check-if-you-need-to-spend-money-on-a-service
      /service-manual/spending-money-on-your-service/apply-for-approval-to-spend-money-on-a-service
      /service-manual/spending-money-on-your-service/check-if-you-need-approval-to-spend-money-on-a-service
      /service-manual/agile-delivery-community
      /service-manual/digital-foundation-day-training
    )
    Guide.where(slug: guide_slugs).each do |guide|
      begin
        GuideSearchIndexer.new(guide).delete
      rescue => e
        puts "Guide failed: #{guide.slug}"
        puts e.inspect
        puts e.backtrace.join("\n")
      end
    end
  end
end<commit_msg>Add index service standard rake task<commit_after>namespace :rummager do
  desc "index all published documents in rummager"
  task index: :environment do
    Guide.all.each do |guide|
      puts "Indexing #{guide.title}..."

      GuideSearchIndexer.new(guide).index
    end

    Rake::Task['rummager:index_service_standard'].execute
  end

  desc 'index the service standard in rummager'
  task index_service_standard: :environment do
    puts "Indexing Service Standard..."

    ServiceStandardSearchIndexer.new.index
  end

  desc "A temporary task to delete some unpublished documents from rummager " \
    "which failed due to a bug"
  task delete_failed: :environment do
    guide_slugs = %w(
      /service-manual/agile-delivery/check-if-you-need-to-spend-money-on-a-service
      /service-manual/spending-money-on-your-service/apply-for-approval-to-spend-money-on-a-service
      /service-manual/spending-money-on-your-service/check-if-you-need-approval-to-spend-money-on-a-service
      /service-manual/agile-delivery-community
      /service-manual/digital-foundation-day-training
    )
    Guide.where(slug: guide_slugs).each do |guide|
      begin
        GuideSearchIndexer.new(guide).delete
      rescue => e
        puts "Guide failed: #{guide.slug}"
        puts e.inspect
        puts e.backtrace.join("\n")
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1087848932676519, 'fraction_numerical': 0.0, 'mean_word_length': 2.911717495987159, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3590142', 'n_tokens_mistral': 814, 'n_tokens_neox': 781, 'n_words': 164}