Acts_as_ferret with Drb :

Hi,

I try to deploy an application using ferret and acts_as_ferret. It’s
ok in devevelpment (Win) and production (Ubuntu) mode without Drb.

But when I enable Drb, acts_as_ferret create troubles. I get a
message :

ferret server error undefined method `to_doc’ for #<DRb::DRbUnknown:
0xb75f66dc>
(full stack at the end)

I don’t understand, all the afternoon trying to solve it, but without
succes. I found things on Google, but it was not enough. Know i really
need help.

I use :

  • Rails 2.0.2
  • Stable acts_as_ferret
  • ferret 0.11.6
  • Ruby 1.8.6
  • Ubuntu server 8.04 LTS as production server
  • Passenger

For acts_as_ferret I use :

  • :fields with some model fields, and specific methods to add data to
    index
  • :remote (but it seems to by obsolete, same without it)
  • :index

What’s wrong with Drb (or me, of course) ?

Thanks for any help.

Sam.


ferret server error undefined method `to_doc’ for #<DRb::DRbUnknown:
0xb75f66dc>

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/local_index.rb:166:in `add’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:102:in `send’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:102:in `method_missing’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:170:in `reconnect_when_needed’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:97:in `method_missing’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:164:in `with_class’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:96:in `method_missing’

/usr/lib/ruby/1.8/drb/drb.rb:1555:in `send

/usr/lib/ruby/1.8/drb/drb.rb:1555:in `perform_without_block’

/usr/lib/ruby/1.8/drb/drb.rb:1515:in `perform’

/usr/lib/ruby/1.8/drb/drb.rb:1589:in `main_loop’

/usr/lib/ruby/1.8/drb/drb.rb:1585:in `loop’

/usr/lib/ruby/1.8/drb/drb.rb:1585:in `main_loop’

/usr/lib/ruby/1.8/drb/drb.rb:1581:in `start’

/usr/lib/ruby/1.8/drb/drb.rb:1581:in `main_loop’

/usr/lib/ruby/1.8/drb/drb.rb:1430:in `run’

/usr/lib/ruby/1.8/drb/drb.rb:1427:in `start’

/usr/lib/ruby/1.8/drb/drb.rb:1427:in `run’

/usr/lib/ruby/1.8/drb/drb.rb:1347:in `initialize’

/usr/lib/ruby/1.8/drb/drb.rb:1627:in `new’

/usr/lib/ruby/1.8/drb/drb.rb:1627:in `start_service’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:79:in `start’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/unix_daemon.rb:18:in `call’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/unix_daemon.rb:18:in `platform_daemon’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/unix_daemon.rb:41:in `fork’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/unix_daemon.rb:41:in `safefork’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/unix_daemon.rb:11:in `platform_daemon’

/var/www/ged_demo/releases/20080522125753/vendor/plugins/
acts_as_ferret/lib/ferret_server.rb:77:in `start’

./script/…/vendor/plugins/acts_as_ferret/lib/server_manager.rb:41:in
`send’

./script/…/vendor/plugins/acts_as_ferret/lib/server_manager.rb:41

script/ferret_server:4:in `require’

script/ferret_server:4

I did a mistake in my post. It’s “:index_dir”, not “:index” (post is
wrong, but code is ok). Sorry.

Before somebody suggest it … I already tried this “workaround”, it
does not work for me :
http://www.ruby-forum.com/topic/131198#585582

I get the same error before, in my case it’s caused by some non-string
fields, so I think you can have a check on your ferret indexed fields:
are they all string?

Good luck,
Jan

Thanks, it’s almost that.

In fact the problem was really obvious, it was a wrong field : I used
association name of the model ! I read many many times the code
without seeing it, and didn’t tested this data in the index in dev
mode (for later use). The solution came yesterday very very late. What
is really disturbing is the fact that it seems to un well in dev mode
(other fields was wall indexed).

Solution (I used for other fields like date or other associations) :
using methods like “ferret_my_special_data” and adding
“:ferret_my_special_data” in :fields option of AAF.

Sometimes the thing is so simple, and we search so far, so crazy
things… like a beginner. I hope my lesson about AAF will help others
and they will not spend hours for so stupid mistake :wink:

Sam.