[英]i need to restrict the results based on the searched key like - full text search
I am using edge ngram with 2 to 25 range.我正在使用范围为 2 到 25 的边缘 ngram。
I am trying to search keyword like 'testing',but i am getting results like 'testing' and the word like 'test'.我正在尝试搜索“测试”之类的关键字,但得到的结果是“测试”和“测试”之类的词。
if i am search key is 'test' in that case both i can get like test and testing.如果我的搜索键是“测试”,那么在这种情况下我都可以得到测试和测试。
what should i need to do get only result 'testing' on search key 'testing', it should not match 'test'我需要做什么只得到搜索键“testing”的结果“testing”,它不应该匹配“test”
My index config:我的索引配置:
$config = '{"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
},
"/":{}
}}';
you need to use the keyword
as a search time analyzer that way it will not tokenize your search term and will bring you the expected Search results.您需要将
keyword
用作搜索时间分析器,这样它就不会标记您的搜索词并会为您带来预期的搜索结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.