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

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

, 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.

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

Cheers, OA

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.