Jens Krämer

Acts as ferret, continued

 |  typo, ferret, rails  |  One comment

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 = 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.

Comments

JanPrill

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

Regards Jan Prill

You can use Markdown here.

For the sake of spam checking any data you submit, including your IP address, will be transferred to the US based Akismet web service (akismet.com). If that's not acceptable for you, you can also reach me by other means.

HTTP/1.1 500 Internal Server Error