Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助,使用match_phrase搜索不到结果 #285

Open
LiuFqiang opened this issue Mar 20, 2023 · 1 comment
Open

求助,使用match_phrase搜索不到结果 #285

LiuFqiang opened this issue Mar 20, 2023 · 1 comment

Comments

@LiuFqiang
Copy link

查看分词结果
GET pinyin_test/_analyze
{
"field": "name.pinyin",
"text": ["刘德华"]
}

{
"tokens" : [
{
"token" : "liu",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 0
},
{
"token" : "ldh",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 0
},
{
"token" : "de",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 1
},
{
"token" : "hua",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 2
}
]
}
含有ldh,但是使用match_parse却搜索不到
GET medcl/_search
{
"query": {
"match_phrase": {
"name.pinyin": "ldh"
}
}
}

{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}

@xiaoshi2013
Copy link

xiaoshi2013 commented Mar 2, 2024

用 POST medcl/_search
{
"query": {
"match_phrase": {
"name.pinyin": "liudehua"
}
}
}
必须每个 position 都有和 刘德华 分词结果匹配的token

ldh 分词后 相同 position 会有不匹配的token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants