# Intermittant Ferret Death

**URL:** <https://www.ruby-forum.com/t/intermittant-ferret-death/162412>\
**Category:** Ferret\
**Created:** [March 9, 2009, 6:24pm UTC](https://www.ruby-forum.com/t/intermittant-ferret-death/162412 "2009-03-09T18:24:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [March 9, 2009, 6:24pm UTC](https://www.ruby-forum.com/t/intermittant-ferret-death/162412/1 "2009-03-09T18:24:31Z")

</div>

Hey All,

I am currently using ferret on multiple models in my application and  
have been experiencing issues for the past few months. When searching  
for some terms ferret performs fine but when searching for other terms  
ferret will return null objects (not really sure why or what is  
occuring) and consequently falldown and the Acts\_as\_ferret plugin seems  
to break.

Here is a more in depth overview of my setup.

- Software Version and Deploy Information  
Ferret (v0.11.6) + DRB Server  
Rails v1.2.6 with a Mongrel Cluster  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-linux]  
Redhat Enterprise Linux 5

- Application Specific Information  
Several Models setup with acts\_as\_ferret (all setup with single\_index =\>  
true)  
Search is being performed via (ActsAsFerret::find\_by\_contents(query))  
Index is stored in a shared directory symlinked to public/index. Between  
deploys index is removed and rake ferret:rebuild\_index is called to  
rebuild it

Again the issue is sometimes I search for a term and I get no results  
without a problem but in other instances searching for a term that I  
know exists will cause an the site to fall down. Another piece  
of information to this puzzle is that the ferret\_rebuild task  
occasionally will simply time out and will need to be killed and  
restarted (this is called during deploys). Since there seems to only be  
a few terms that break the site I assumed that this is an index related  
problem. I have been able to successfully remove the index directory and  
call rake ferret:rebuild\_index when on the box but this issue still  
persists.

Here is a relevant stack trace of when the issue occurs.  
An exception occurred in the Application:

EXCEPTION:  
NoMethodError in search#index

ERROR:  
undefined method `[]’ for nil:NilClass

[RAILS\_ROOT]/vendor/plugins/acts\_as\_ferret/lib/shared\_index\_class\_methods.rb:53:in  
`ar_find_by_contents' [RAILS_ROOT]/vendor/plugins/acts_as_ferret/lib/shared_index_class_methods.rb:53:in`sort!’  
[RAILS\_ROOT]/vendor/plugins/acts\_as\_ferret/lib/shared\_index\_class\_methods.rb:53:in  
`ar_find_by_contents' [RAILS_ROOT]/vendor/plugins/acts_as_ferret/lib/class_methods.rb:288:in`find\_records\_lazy\_or\_not’  
[RAILS\_ROOT]/vendor/plugins/acts\_as\_ferret/lib/shared\_index\_class\_methods.rb:42:in  
`find\_by\_contents’

Any thoughts, suggestions or ideas would be greatly appreciated. Thanks

-David
