Hi all and thank you for the information about associations and AAF. I
have a problem yet with the update of the index cause when a model is
updated, AAF does not updte the upper model using it. Is there a whay to
force the reindexing of a model?
Jens K. wrote:
On Tue, Sep 18, 2007 at 06:10:38AM +0200, Adam J. wrote:
I think i answered my own question.
in the create method for my note i added
Contact.find(params[:id]).ferret_create()
right, however I’d stick that code in a NotesObserver…
Donegarden,
I believe your question is like my last one.
All you have to do is find the item in the model and execute the
ferret_create() method on it.
This is the same as an update.
Ie/
Widget.find(params[:id]).ferret_create()
As Jens suggested this would be best in an observer but it will also
work in the controller after you have updated the model
Adam
Donegarden Dg wrote:
Hi all and thank you for the information about associations and AAF. I
have a problem yet with the update of the index cause when a model is
updated, AAF does not updte the upper model using it. Is there a whay to
force the reindexing of a model?
I just quickly looked up the inflections to see if that was the problem.
However your relationship is a has_many which therefore means, how does
ferret know which one of the resumes you’re talking about?
The original point of this thread was to do with models that had a 1-1
polymorphic relationship so that you knew where to find the rest of the
data. What you could do is index the resume’s table which would also
include their user_id by default, then do a conditional search on that
user_id if you wanted to search amongst resume’s. You can also add extra
fields like user.name from the resume model because that’s a 1-1
relationship from the perspective of the single resume.
Hope that helps
Cheers,
Brendon
dude thanks! solved the whole “problem” after a few hours and couldnt
resist to blog about it:
Followed this thread and have a has_many_through association indexing
fine. The only problem is the N+1 sql queries incurred with an index
rebuild, full or partial.
Is there any way to enable eager loading on batch index updates?
I just quickly looked up the inflections to see if that was the problem.
However your relationship is a has_many which therefore means, how does
ferret know which one of the resumes you’re talking about?
The original point of this thread was to do with models that had a 1-1
polymorphic relationship so that you knew where to find the rest of the
data. What you could do is index the resume’s table which would also
include their user_id by default, then do a conditional search on that
user_id if you wanted to search amongst resume’s. You can also add extra
fields like user.name from the resume model because that’s a 1-1
relationship from the perspective of the single resume.
Hope that helps
Cheers,
Brendon
hi everyone!
i was following this thread and tried the above, as its exactly my
problem as well:
On Thu, Mar 13, 2008 at 05:01:26AM +0100, Sam G. wrote:
Followed this thread and have a has_many_through association indexing
fine. The only problem is the N+1 sql queries incurred with an index
rebuild, full or partial.
Is there any way to enable eager loading on batch index updates?
Yes. Acts_as_ferret defines a class method named records_for_rebuild on
your model, which you may override to use a customized find call.
See lib/class_methods.rb for the original implementation.