简体   繁体   English

Ruby on Rails插件acts_as_ferret是否非常容易越野车?

[英]Is ruby on rails plugin, acts_as_ferret, very buggy?

I am doing a very simple search on my DB using acts_as_ferret. 我正在使用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. 我在日志中看到正在对索引执行正确的查询“ The〜”。 However, I get no results. 但是,我没有结果。 I definitely have a few "Venues" with the word "The" in the name field. 我肯定在名称字段中有几个带有“ The”字样的“ Venues”。

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 由于这是一个非常简单的搜索,并且使用了acts_as_ferret相当多,因此我尝试重建索引以查看其是否损坏。

Any ideas? 有任何想法吗?

Thanks! 谢谢!

Yes, Ferret has been very well known for corrupting indexes. 是的,雪貂因破坏索引而闻名。

I recommend switching over to another searching plugin like Thinking Sphinx . 我建议切换到另一个搜索插件,例如Thinking Sphinx You can watch the Railscast about it in order to learn more. 您可以观看Railscast以获得更多信息。

I think the problem might be that "the" is defined as a stopword- an extremely common word that is not indexed because it would just return every document. 我认为问题可能在于“ the”被定义为停用词,这是一个非常普遍的词,没有索引,因为它只会返回每个文档。 You can configure your stopword list. 您可以配置停用词列表。

I would consider using Solr if you are having problems with Ferret. 如果您遇到雪貂问题,我会考虑使用Solr。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM