Jens Krämer

Acts as ferret, continued

 |  typo, ferret, rails

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:

require 'ferret' index = :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.



Great stuff! Thanks for sharing this, I'll definitly try it out!

Jan Prill