Fuzzy Search in the Search API

2019-03-30 22:00发布

The Azure search api offers a fuzzy paramter for suggestions. like this:

https://blssuggestions.search.windows.net/indexes/cities/docs/suggest?api-version=2015-02-28&suggesterName=default&fuzzy=true&search=berlen

Would return "Berlin" as a result of berlen.

I can't find a documentation about this how to activate it in a normal search setting there fuzzy = true seems to not change anything

https://blssuggestions.search.windows.net/indexes/cities/docs?api-version=2015-02-28&search=berlen&fuzzy=true

3条回答
一纸荒年 Trace。
2楼-- · 2019-03-30 22:27

You need to call:

https://blssuggestions.search.windows.net/indexes/cities/docs/suggest?api-version=2015-02-28&suggesterName=default&queryType=full&search=berlen~

You were missing querytype=full and the tilde after the character that you want to execute fuzzy searches on.

查看更多
Lonely孤独者°
3楼-- · 2019-03-30 22:33

[Update]: Please see the other responsed about using querytype=full as this response is no longer correct.

This is correct. Fuzzy search is only available currently in the suggestions api.

查看更多
家丑人穷心不美
4楼-- · 2019-03-30 22:42

This is now in the preview version of the api:

https://{yourSite}.search.windows.net/indexes/{yourIndex}/docs?search={fieldToSearch}:{lookupValue}~&queryType=Full&api-version=2015-02-28-preview

Note the ~ and queryType=Full, both of which are required to force fuzzy matching.

Documentation is here:

https://msdn.microsoft.com/library/azure/mt589323.aspx

CAVEAT: The fuzzy search is very fuzzy! i.e. dog will match any 3 letter word with only a single matched letter - dim, now, bag

I am trying to figure out how to tune and tweak but as it is still in preview the documentation is sparse.

UPDATE: I just re-read the documentation and it has since been updated with details of an optional distance parameter. I will investigate.

查看更多
登录 后发表回答