update each record in order to update Ferret index?

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

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.

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

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

Hi 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

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_server

Give 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