On Fri, Aug 25, 2006 at 12:10:26PM +0100, Pedro Côrte-Real wrote:
> I'd like to be able to enable/disable the automatic indexing of
> documents acts_as_ferret does. Something like MyModel.disable_indexing
> MyModel.enable_indexing would be perfect. I need this because I do some
> indexing that requires visiting the parents of the model objects and my
> import method imports the children first, so the information isn't there
> yet. I'd like to disable the indexing, do all the importing and then
> manually index the documents. Having a MyModel#index would be great for
> this too.
> 
> Is there anything of the sort?

there's an instance variable @ferret_reindex that's checked before the
indexing takes place.
Something like

def save_noindex
  @ferret_reindex = false
  save
end

in your model should save the record without reindexing it. The boolean
is set to true in the after_save handler again, so the next call to save
should reindex again. You may call ferret_update directly to reindex
without saving, too.

Jens

-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to