Azure Search Suggester - fuzzy not returning results

拥有回忆 提交于 2019-12-24 06:30:27

问题


I created a new Azure Search Suggester but implemented Fuzzy search with the following code:

ISearchIndexClient indexClient = CreateSearchIndexClient();
var suggestParameters = new SuggestParameters();
suggestParameters.UseFuzzyMatching = true;
suggestParameters.MinimumCoverage = 100;

DocumentSuggestResult response = indexClient.Documents.Suggest(term, "suggester", suggestParameters);
IList<SuggestResult> results = response.Results;

The index contain the string "China", but when I search using the following "chn", no suggestion is return. I expect that fuzzy search will be able to return "China".

Searching for "chi" will return "China" as a suggestion correctly.

Can anyone advise what I am doing wrong? Thank you


回答1:


The short answer to your question is that we do not expect "chn" to return "china" as a result.

The long answer is: suggestions with fuzzy matching happen in two steps. The first step is attempting to "complete" the last term of the query by finding matching words that have that term as a prefix. Only then do the edit distance kicks in as the second step which is to expand each term in the query using an edit distance of 1.

Since the word "chn" is not a prefix to "china", it won't be returned part of the first step. Since "chn" is 2 edit distance away from "china", its not found in the second step either. On the other side, "chi" is a prefix to "china", so its found during the first step. I expect that if you run the search query with "chna", "china" would be succesfully returned.

Hope this answers your question.



来源:https://stackoverflow.com/questions/49126737/azure-search-suggester-fuzzy-not-returning-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!