Does Azure Search handle synonyms

2019-02-25 13:56发布

问题:

Can "Azure Search" search based on synonyms?

E.g. If I search for 'footwear', the system should fetch results of synonyms of footwear like shoes, sandals e.t.c.

I searched a lot and failed to find proper documentation about it. The closest I could find is a post saying it doesn't support yet, but it's an old post - https://social.msdn.microsoft.com/Forums/en-US/9d0873cf-14aa-4d3e-b33f-a047963e8671/internationalized-search-finding-both-color-and-colour?forum=azuresearch

回答1:

Unfortunately, we have not added automatic synonym support yet to Azure Search. Certainly as you might imagine this is a pretty important feature which we hear quite a bit so we do have plans in this area. In the mean time, let me give a few pointers:

1) We do support stemming and in fact the Microsoft Natural Language Processor (NLP) that is part of our preview api 02-28-2015-Preview is really good at lemitization which provides a really deep understanding of 50 languages to allow you to get different forms of words. In English a good example would be where we can find mice when you search for mouse. It also handles tenses (masculine / feminie forms of words) really well also. I realize that this is not what you are referring to in your question, but might be something you can leverage. More details on this here: https://azure.microsoft.com/en-us/documentation/articles/search-api-2015-02-28-preview/#LanguageSupport

2) If you know the synonyms you want to use there are a few techniques you can use to achieve synonym support in Azure Search including:

  • Use our Collection datatype where you go through the content of your documents and where there is a possible match to a synonym word, add that synonym word to the collection field for that document. That way, if someone does a search for the synonym word, it will come up as a match
  • Create a separate index that just includes these synonym words. When you do a search (or a suggestion search), it goes against this “synonym” index to get all the possible matches and then does the appropriate query against the main index.

I hope that helps