In my last post I forgot to mention how to create the initial ferret index. I have a little script for this in vendor/plugins/acts_as_ferret:
1 2 3 4 5 6 7 8 9 |
require 'ferret' index = Ferret::Index::Index.new( :path => "#{RAILS_ROOT}/index/contents", :create => true ) Content.find_published.each { |content| index << content.to_doc } index.flush index.optimize index.close |
Calling this with
RAILS_ENV=production script/runner 'require "vendor/plugins/acts_as_ferret/rebuild_index"'
will rebuild the index from all existing Articles, Comments and Pages in your production database.
