我正在使用Tire/ElasticSearch对rails应用程序中的模型进行索引。
我正在尝试设置一个非常简单的more_like_this查询,如下所示:索引“/field”内容
s = Tire.search 'articles' do
query do
mlt_field do
content { string 'electricity' }
end
end
end当我运行这个程序时,我会得到这个错误。
undefined method `mlt_field' for #<Tire::Search::Query:0x000001013657e8 @value={}>有人知道我是怎么安排这个的吗?我已经看过非常好的轮胎文件,但我看不出有什么帮助。我发现了一个类似的查询,fuzzy_like_this和Github问题都是用来在自述文件中搜索模糊的,但是我找不到相关的引用。
发布于 2013-09-04 10:54:07
最后,我使用了直接查询语法,它似乎没有抛出任何错误。
s1 = Tire.search 'articles', :query =>
{ :mlt_field =>
{ :content =>
{ :like_text => 'electricity',
:min_term_freq => 1,
:analyzer => :mlt_content
}
}
}https://stackoverflow.com/questions/18579178
复制相似问题