我正在使用轮胎,我们面临搜索结果问题。 我们正在寻找铅笔'
这是模型上的轮胎设置:
settings :analysis => {
:analyzer => {
:my_analyzer => {
"tokenizer" => "lowercase",
# "filter" => ["synonym", "porterStem", "phonetic"]
"filter" => ["synonym", "porterStem"]
}
},
:filter => {
:synonym => {
"type" => "synonym",
"synonyms_path" => "#{Synonym.path}"
}
}
} do
mapping do
indexes :commodity_code
indexes :commodity_name
indexes :long_description, analyzer: 'my_analyzer'
indexes :short_description, boost: 10, analyzer: 'my_analyzer'
答案 0 :(得分:0)
默认情况下,查询electronic pencil sharpener
将被翻译为electronic OR pencil OR sharpener
。
如果您要排除包含sharpener
的文档,请使用以下查询:electronic OR pencil NOT sharpener
或+electronic +pencil -sharpener
。
查看bool
和match
查询以在Query DSL中表达这些条件; https://github.com/karmi/tire/tree/master/test/integration