using lucene fuzzy search and synonyms with Azure Search

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 10:46:14

问题


I want to be able to handle fuzzy search, as well as synonyms at the same time. I tried it in a several ways, but I cannot get it working.

I have these values in my index:

white
black
light
dark

and this synonym rules:

white,light
black,dark

If I perform the query queryType=full&search=light or queryType=full&search=white, it always returns both values, light and white. So synonyms are working.

If I perform the query queryType=full&search=light~1, then only light will be returned. But where is white?

Is the combination of fuzzy search and synonyms not possible yet, or am I doing something wrong?


回答1:


Synonym expansions do not apply to wildcard search terms; prefix, fuzzy, and regex terms aren't expanded.

If you need to do a single query that applies synonym expansion and wildcard, regex, or fuzzy searches, you can combine the queries using the OR syntax.

For example, to combine synonyms with fuzzy search you would need to have query like this:

search=light~1|light

or

queryType=full&search=light OR light~1

if you're using Lucene query syntax



来源:https://stackoverflow.com/questions/54082779/using-lucene-fuzzy-search-and-synonyms-with-azure-search

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