Sha256: 0f4252f7c9c005f62d9bbb6a45e5db32ace67cbed01bd49cc2b9daf2740ec300

Contents?: true

Size: 636 Bytes

Versions: 2

Compression:

Stored size: 636 Bytes

Contents

require 'ruby-progressbar'

module Pose
  module Jobs

    # Cleans up unused data in the search index.
    class Vacuum
      def perform
        puts "Cleaning Pose search index...\n\n"

        progress_bar = ProgressBar.create title: '  assignments', total: Pose::Assignment.count
        Pose::Assignment.cleanup_orphaned_pose_assignments progress_bar
        progress_bar.finish

        progress_bar = ProgressBar.create title: '  words', total: Pose::Word.count
        Pose::Word.remove_unused_words progress_bar
        progress_bar.finish

        puts "\nPose search index cleanup complete.\n\n"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pose-3.2.0 lib/pose/jobs/vacuum.rb
pose-3.1.1 lib/pose/jobs/vacuum.rb