Sha256: a3e2fd59f9b5ad6e970aae67192a2f3a953473925ef64604ab6a09df370a2951

Contents?: true

Size: 565 Bytes

Versions: 3

Compression:

Stored size: 565 Bytes

Contents

namespace :mongoid_search do
  desc 'Goes through all documents with search enabled and indexes the keywords.'
  task index: :environment do
    ::Rails.application.eager_load!
    if Mongoid::Search.classes.blank?
      Mongoid::Search::Log.log "No model to index keywords.\n"
    else
      Mongoid::Search.classes.each do |klass|
        Mongoid::Search::Log.silent = ENV['SILENT']
        Mongoid::Search::Log.log "\nIndexing documents for #{klass.name}:\n"
        klass.index_keywords!
      end
      Mongoid::Search::Log.log "\n\nDone.\n"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid_search-0.4.0 lib/mongoid_search/tasks/mongoid_search.rake
mongoid_search-0.3.6 lib/mongoid_search/tasks/mongoid_search.rake
mongoid_search-0.3.5 lib/mongoid_search/tasks/mongoid_search.rake