ferret - mysql server has gone away

I've problem with ferret (acts_as_ferret). search-engine and webserver are on the same machine. I use acts_as_ferret :field => ... to define which columns are indexed. I recreate the index with Search.rebuild_index (Search is my model).

To find some results, I use Search.find_with_ferret("keyword", {}, {}). Sometimes, I merge conditions to this query in the last hash. I create an index over 7'000 records.

For a while, the search is run correctly. Suddently, after perhaps 10 requests, I receive the error message below and the search doesn't run anymore.

Has someone a solution for this problem??? Thanks for helping!

ActiveRecord::StatementInvalid: Mysql::Error: MySQL server has gone away: SELECT * FROM `searches` WHERE (searches.id in ('266582','261710','261788','266607','262659','258206','261781','258207','261783','262124'))   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/mysql_adapter.rb:299:in `execute'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/mysql_adapter.rb:515:in `select'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:582:in `find_by_sql'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1341:in `find_every'   from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:536:in `find'   from /home/schwinge/ruby/gems/gems/acts_as_ferret-0.4.3/lib/class_methods.rb:384:in `retrieve_records'   from /home/schwinge/ruby/gems/gems/acts_as_ferret-0.4.3/lib/class_methods.rb:360:in `each'   from /home/schwinge/ruby/gems/gems/acts_as_ferret-0.4.3/lib/class_methods.rb:360:in `retrieve_records'   from /home/schwinge/ruby/gems/gems/acts_as_ferret-0.4.3/lib/class_methods.rb:300:in `ar_find_by_contents'   from /home/schwinge/ruby/gems/gems/acts_as_ferret-0.4.3/lib/class_methods.rb:288:in `find_records_lazy_or_not'   from /home/schwinge/ruby/gems/gems/acts_as_ferret-0.4.3/lib/class_methods.rb:185:in `find_with_ferret'   from (irb):19