On 11/7/07, Alex Neth <[EMAIL PROTECTED]> wrote:
> Thanks Jens.   Any suggestion on how to get a two index solution
> working with acts_as_ferret?

I rolled my own with methods in my model class, something like this:

    def self.setup_new_index(location)
      config = aaf_configuration[:ferret].dup
      config.update(:create => true, :auto_flush => false,
                    :field_infos => ActsAsFerret::field_infos([self]),
                    :path => location)
      index = Ferret::Index::Index.new(config)
      index.logger = Logger.new("#{location}/index.log")
      index
    end


    def self.build_new_index(location)
      index = setup_new_index(location)

      max = self.maximum(:id)
      start = self.minimum(:id)

      start.step(max, increment) do |n|
        begin
          record = self.find(n)
        rescue ActiveRecord::RecordNotFound
          next
        end
        index << record.to_doc if record and record.ferret_enabled?(true)
      end
    end

Then I have a rake task to replace the old index with the new one.

-Stuart Sierra
columbialawtech.org
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to