在Sunspot和WebSolr中匹配3个术语中的2个 [英] Matching 2 out of 3 terms in Sunspot and WebSolr

查看:160
本文介绍了在Sunspot和WebSolr中匹配3个术语中的2个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的搜索部分匹配无法正常工作。当我输入都柏林爱尔兰进入我的搜索时,它会正确地返回爱尔兰都柏林的所有结果。然而,当我输入County Dublin Ireland时,它不会返回任何内容。



我在schmea.xml中设置了一个EdgeNGramFilter,如下所示:

 < filter class =solr.EdgeNGramFilterFactoryminGramSize =1maxGramSize =10/> 

我正在位置上的太阳黑子端进行全文搜索:


$ b $

  search_results = Events.solr_search do 
全文位置
字段(:地址)
结束
结束

即使3个字词中有2个匹配,我怎么没有收到结果?

解决方案

默认情况下,Sunspot使用DisMax Query Parser,并支持 minimum_match 方法在全文区块内。

  search_results = Events.solr_search do 
全文位置
字段:地址
最低匹配2
结束
结束

另见:


THe partial matching on my search is not working correctly. When I type in "Dublin Ireland" into my search then it correctly returns all the results in Dublin, Ireland. However, when I type "County Dublin Ireland" then it doesn't return any.

I've set up an EdgeNGramFilter in my schmea.xml like so:

<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="10"/>

And I'm doing a fulltext search on the sunspot end on location:

search_results = Events.solr_search do
  fulltext location do
    fields(:address)
  end
end

How come I'm getting no results even though 2 out of the 3 terms match?

解决方案

By default, Sunspot uses the DisMax Query Parser, and supports a minimum_match method within the fulltext block.

search_results = Events.solr_search do
  fulltext location do
    fields :address
    minimum_match 2
  end
end

See also:

这篇关于在Sunspot和WebSolr中匹配3个术语中的2个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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