雪貂搜索不适用于我的rails应用程序

时间:2011-10-31 06:49:06

标签: ruby-on-rails ruby ruby-on-rails-3 ferret acts-as-ferret

首先,我登录ruby script/console -e production并尝试使用

索引每个表
Model.rebuild_index 

工作正常并返回true

然后我使用命令

启动了雪貂服务器
ruby script/ferret_server start -e production

然后我启动了我的应用程序,除搜索外,一切正常。当我尝试在搜索选项卡上搜索时,我收到如下错误:

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.

搜索在控制台中正常运行

result = ActsAsFerret.find("admin",[User], :limit => 2)确实会获取结果

2 个答案:

答案 0 :(得分:0)

使用以下方法安装了OS的wordnet数据文件的副本:

sudo apt-get install wordnet-base

Word实际上源自Wordnet:

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

答案 1 :(得分:-1)

没什么好奇的 ActiveRecord没有方法rebuild-index