我正在使用ElasticSearch和Tire执行一些基本的搜索功能,但是雪球干扰分析器的基本配置让我难住了。我几乎从以下GitHub的页面代码示例:https://github.com/karmi/tire使用轮胎库进行干扰
下面是一个Ruby示例文件(红宝石1.9.3,轮胎25年8月1日):
require 'tire'
Tire.index 'videos' do
delete
create :mappings => {
:video => {
:properties => {
:code => { :type => 'string' },
:description => { :type => 'string', :analyzer => 'snowball' }
}
}
}
end
videos = [
{ :code => '1', :description => "some fight video" },
{ :code => '2', :description => "a fighting video" }
]
Tire.index 'videos' do
import videos
refresh
end
s = Tire.search 'videos' do
query do
string 'description:fight'
end
end
s.results.each do |document|
puts "* #{document.code} - #{document.description}"
end
我本来期望这产生在比赛中都有记录,因为战斗和战斗具有相同的主干。然而,它只返回的第一条记录:
* 1 - some fight video
这表明默认分析仪正在使用,而不是一个,我配置。
我知道在查询字符串中传递实际字段(ElasticSearch mapping doesn't work)并已成功运行此代码,因此我的ElasticSearch安装看起来很好。
我需要做什么来改变轮胎的这个查询(即我如何才能制止在这里工作)返回两个记录?