Hi, I''m having some problems on a particular acts_as_ferret model. Rebuilding the index with Model.rebuild_index does not seem to work. No results are returned after indexing. However, when I update each record manually, the index seems to be correct. This is my model: class Article < ActiveRecord::Base ... acts_as_articlequerybuilder acts_as_messageuser :Article,:title,:body,:excerpt acts_as_ferret :fields => [ :active_title,:active_excerpt,:joined_tags ], :remote => true ... end The fields specified are custom methods, defined in acts_as_messageuser. Maby this is causing some troubles with ferret : #active_title => returns title field in current active language define_method(''active_''+param.to_s) do value = read_attribute(param.to_s) language = $activelanguage.code.to_sym if value Message.find(value).send(language) else nil end end Can somebody point me in the right direction? Oh, I''m using ferret_server in production mode. Ferret works fine on the model in development mode without ferret_server Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Müller
2008-Sep-25 11:44 UTC
Re: update each record in order to update Ferret index?
no real help for your actual problem. But we moved an existing project from ferret to sphinx, for exactly the reasons you mention. Everything working fine in dev, but fails in prod. If you google around a bit, you''ll find that this seems a common problem with ferret. I would recommend moving to sphinx. Depending on amount of models that use ferret, this shouldn''t take more than a day or two. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Conrad Taylor
2008-Sep-25 12:26 UTC
Re: update each record in order to update Ferret index?
On Thu, Sep 25, 2008 at 4:30 AM, Maarten Porters < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I''m having some problems on a particular acts_as_ferret model. > Rebuilding the index with Model.rebuild_index does not seem to work. No > results are returned after indexing. However, > when I update each record manually, the index seems to be correct. > > This is my model: > > class Article < ActiveRecord::Base > > ... > acts_as_articlequerybuilder > acts_as_messageuser :Article,:title,:body,:excerpt > acts_as_ferret :fields => [ :active_title,:active_excerpt,:joined_tags > ], :remote => true > > ... > > end > > The fields specified are custom methods, defined in acts_as_messageuser. > Maby this is causing some troubles with ferret : > > #active_title => returns title field in current active language > define_method(''active_''+param.to_s) do > value = read_attribute(param.to_s) > language = $activelanguage.code.to_sym > if value > Message.find(value).send(language) > else > nil > end > end > > Can somebody point me in the right direction? Oh, I''m using > ferret_server in production mode. Ferret works fine on the model in > development mode without ferret_server >Hi, could you tell us about the actual configuration of ferret? How''s Ferret working in development mode without the ferret_server? Is the ferret_server up and operational in the production environment? -Conrad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maarten Porters
2008-Sep-25 13:19 UTC
Re: update each record in order to update Ferret index?
> Hi, could you tell us about the actual configuration of ferret? How''s > Ferret > working in development mode without the ferret_server? Is the > ferret_server > up and operational in the production environment? > > -ConradHi Conrad, In development mode, I''m just using the local index without any ferret server. In production mode, the ferret server is definitely doing it''s job. Most models using ferret, are simple models with straightforward fields. However, the article model is a bit more complex and doesn''t index unless I update each record manually. here is my server config: development: host: localhost port: 9015 pid_file: log/ferret.pid log_file: log/ferret_server.log Hmm ... If I can''t fix it, I have two options: - Iterate trough all articles and update manually once in a while - try out to Sphinx -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maarten Porters wrote:> I''m having some problems on a particular acts_as_ferret model. > Rebuilding the index with Model.rebuild_index does not seem to work. No > results are returned after indexing. However, > when I update each record manually, the index seems to be correct. > > This is my model: > > class Article < ActiveRecord::Base > > ... > acts_as_articlequerybuilder > acts_as_messageuser :Article,:title,:body,:excerpt > acts_as_ferret :fields => [ :active_title,:active_excerpt,:joined_tags > ], :remote => true > > ... > > end > ... > Can somebody point me in the right direction? Oh, I''m using > ferret_server in production mode. Ferret works fine on the model in > development mode without ferret_serverGive this a go: class Article acts_as_ferret :fields => [...] cattr_accessor :ferret_server self.ferret_server = ActsAsFerret.remote? ? aaf_index : self end Article.ferret_server.rebuild_index -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---