# Ferret OK in development, doesn't work right in production

**URL:** <https://www.ruby-forum.com/t/ferret-ok-in-development-doesnt-work-right-in-production/124176>\
**Category:** Rails\
**Created:** [December 26, 2007, 5:35am UTC](https://www.ruby-forum.com/t/ferret-ok-in-development-doesnt-work-right-in-production/124176 "2007-12-26T05:35:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OAOAOA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f4b2a3/32.png) [@OAOAOA](https://www.ruby-forum.com/u/OAOAOA)\
**Post date:** [December 26, 2007, 5:35am UTC](https://www.ruby-forum.com/t/ferret-ok-in-development-doesnt-work-right-in-production/124176/1 "2007-12-26T05:35:27Z")

</div>

Hi all,

I am developing my app on OS X and deploying regularly to a linux box  
that I’ve got running on CentOS. I recently started using  
acts\_as\_ferret on one of my simple models and it has been doing great.  
Last night, I tried implementing it for a more heavily used model and  
I ran into a strange problem.

On my development mac, everything works great. I included 2 fields,  
deleted the index folder, implemented the pagination functions as  
suggested in the famous tutorial:

[http://www.railsenvy.com/2007/2/19/acts-as-ferret-tutorial](http://www.railsenvy.com/2007/2/19/acts-as-ferret-tutorial)

, sat back and tested my new full text search engine with great  
pleasure and satisfaction.

My production ferret\_server configuration was already in place since I  
have been using it for another model. I just deployed using  
capistrano, deleted the index directory and waited for the new model  
to build its index - which took a while due to the large number of  
rows.

Then when I tried using the search function, I got very few, if any  
results. Interestingly, pagination still predicted several pages  
where I could not see any results. I’ve been working at it for hours  
and I think I ruled out any common, stupid mistakes. Again, what’s  
interesting is that the exact same code is doing wonders on my laptop.

I know it’s kind of a shot in the dark but I would appreciate any  
input. Let me know if I can answer any questions.

Best,  
OA

Note: My indexed fields contain non-English UTF-8 encoded entries. I  
set the LANG environment variable to en\_US.UTF-8 in environment.rb.

---

<div class="post-metadata">

**Author:** ![OAOAOA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f4b2a3/32.png) [@OAOAOA](https://www.ruby-forum.com/u/OAOAOA)\
**Post date:** [December 26, 2007, 5:37am UTC](https://www.ruby-forum.com/t/ferret-ok-in-development-doesnt-work-right-in-production/124176/2 "2007-12-26T05:37:47Z")

</div>

Also, ferret is still working great in that other smaller model.

Cheers,  
OA

---

<div class="post-metadata">

**Author:** ![OAOAOA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f4b2a3/32.png) [@OAOAOA](https://www.ruby-forum.com/u/OAOAOA)\
**Post date:** [December 26, 2007, 3:49pm UTC](https://www.ruby-forum.com/t/ferret-ok-in-development-doesnt-work-right-in-production/124176/3 "2007-12-26T15:49:19Z")

</div>

Ferret is a bit finicky in production, mainly because you have to make  
sure that no one is using the system and updating/inserts data while  
it’s creating your index. If any data is modified while the index is  
being created, it will attempt to update the ferret index, and that’s  
not good. So you have to make sure no one else is using the system.

In my production system, I didn’t fully shut production down, I just  
disabled creation of any new data during the initial indexing. It took  
like 6 hours to index everything. Then I put the app back to its  
normal state. Everything worked fine.

However, the Ferret index frequently became corrupted and I’d have to  
reindex the whole database again. But that’s another issue entirely.
