Sha256: 96c7e4babe90af1f5d18db112270b686bf4e1f2969ba9e969f2287aad170567e

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

desc 'Ferret index maintenance tasks'
namespace :index do
  desc 'Clear indexes'
  task :clear => :environment do
    Indexer.clear! :all
  end

  desc 'Create index'
  task :create => :environment do
    Indexer.index_every_directory(remove_first=true)
  end

  desc 'Update index'
  task :update => :environment do
    Indexer.index_every_directory
  end
  
  desc 'Remove unneeded files from index'
  task :prune => :environment do
    Indexer.prune_index
  end

  desc 'Returns the number of indexed documents'
  task :size => :environment do
    puts "#{Indexer.size} documents are currently indexed in #{Picolena::IndexSavePath}"
  end

  desc 'Returns the last time the index was created/update'
  task :last_update => :environment do
    puts Indexer.last_update
  end

  # Search index with query "some query" :
  # rake index:search query="some query"
  desc 'Search index'
  task :search => :environment do
    puts Finder.new(ENV["query"]).matching_documents.entries.collect{|doc| doc.inspect}.join("\n"<<"#"*80<<"\n")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.1.8 lib/picolena/templates/lib/tasks/index.rake
picolena-0.2.0 lib/picolena/templates/lib/tasks/index.rake
picolena-0.2.2 lib/picolena/templates/lib/tasks/index.rake