Hi!

On Wed, Sep 20, 2006 at 11:22:52AM +0200, David Sheldon wrote:
> David Sheldon wrote:
> 
> > How much overhead would it be to write an "add_value" method that is 
> > called, say 10 times per doc, which will lookup the field we're going to 
> > add in the index, and add it if it isn't already there?
> 
> Ok, I've done this. But it was causing problems when called from 
> rebuild_index, as there isn't an index at that point, and I was calling 
> ferret_index on my model, which was creating a new index which couldnt 
> get a write lock for my new fields.
> 
> I have solved this by giving to_doc an optional index parameter that is 
> passed in when rebuild is running, but if it is nil, it will call 
> Model.ferret_index.
> 
> It seems like an incorrect separation for the index to be passed in to 
> the to_doc method. Have you any suggestions on how to make this nicer?

I could change the way rebuild_index works so that it uses and
initializes the Ferret index instance returned by ferret_index. So you
could access the index instance in to_doc when being called by
rebuild_index, 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