ruby-on-railsrubyruby-on-rails-3ferretacts-as-ferret

Ferret search not working for my rails app


First, I logged into the ruby script/console -e production and tried to index each table using

Model.rebuild_index 

It worked fine and returned true

I then started the ferret server using the command

ruby script/ferret_server start -e production

Then i started my application and it's all working fine except the search. When i try searching on the search tab, i get an error as follows :

Words::BadWordnetDataset in HomeController#search

Failed to locate the wordnet database. Please ensure it is installed and that 
if it resides at a custom path that path is given as an argument when 
constructing the Words object.

The search is working fine in the console

result = ActsAsFerret.find("admin",[User], :limit => 2) does fetch me results


Solution

  • Installed the copy of the wordnet data files for OS using :

    sudo apt-get install wordnet-base
    

    Word is actually derived from Wordnet :

    require 'word'
    data =  Words::Wordnet.new