I am doing a very simple search on my DB using acts_as_ferret. I put this in my "Venue" model:
acts_as_ferret :fields => [:name, :city]
And this is in my controller search action:
@t = Venue.find_by_contents(params[:search]+'~')
and then I just render the results.
render :text => @t.to_json, :success => true, :status => :ok
If I run a quick test:
http://localhost:3000/venue/list?search=The
I see in my log that the proper query "The~" is being executed on the index. However, I get no results. I definitely have a few "Venues" with the word "The" in the name field.
Since this is a very simple search and acts_as_ferret is used quite a bit, I tried rebuilding the index to see if it was corrupted....no dice
Any ideas?
Thanks!
Yes, Ferret has been very well known for corrupting indexes.
I recommend switching over to another searching plugin like Thinking Sphinx. You can watch the Railscast about it in order to learn more.