Solr 太阳黑子 minimum_match [英] Solr Sunspot minimum_match

查看:36
本文介绍了Solr 太阳黑子 minimum_match的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用 Solr Sunspot for Rails 的新手.我正在尝试使用

I'm new to using Solr Sunspot for Rails. I'm trying to use the

<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>

所以自然不是所有的标记都会匹配.我不知道如何在我的搜索 http://outoftime 中使用 minimum_match 功能.github.com/sunspot/docs/index.html.任何帮助将不胜感激.

So naturally not all of the tokens are going to match. I can't figure out how to use the minimum_match feature in my search http://outoftime.github.com/sunspot/docs/index.html. Any help would be greatly appreciated.

我试过了,结果只有 0 个:

I tried and I just get 0 results:

Articles.search do
  fulltext params[:q] do
   :minimum_match => 1
  end
end

推荐答案

大功告成.哈希语法是当您将最小匹配作为参数传递给 fulltext 时.

You're almost there. The hash syntax is when you're passing minimum match as a parameter to fulltext.

Article.search do
  fulltext params[:q], :minimum_match => 1
end

在块内,您需要一个方法调用.

Within a block, you want a method invocation.

Article.search do
  fulltext params[:q] do
    minimum_match 1
  end
end

这篇关于Solr 太阳黑子 minimum_match的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆