According to article https://azure.microsoft.com/pl-pl/blog/azure-search-synonyms-public-preview/ I should be to use multi-word/phrase synonym in synonymMaps
Multi-word synonyms
In many full text search engines, support for synonyms is limited to single words. Our team has engineered a solution that allows Azure Search to support multi-word synonyms. This allows for phrase queries (“”) to function properly while using synonyms. If someone has mapped ‘hot tub’ to ‘whirlpool bath’ and they then search for “large hot tub,” Azure Search will return matches which contain both “large hot tub” and “large whirlpool bath.”
However, in my case I got match on sub words.
My synonymMap looks like:
{"name":"map",
"format":"solr",
"synonyms":"Gastroenterology (acute and chronic),vomiting, diarrhoea, weight loss\n"}
And I have documents in search index which contains medicine disciplines like Gastroenterology (acute and chronic).
What I receives after ?search="vomiting"
is:
{
"@search.score": 1.0405536,
"@search.highlights": {
"disciplines/name": [
"<em>Acute</em> <em>and</em> <em>chronic</em> ear disease",
"<em>Acute</em> <em>and</em> <em>chronic</em> skin disease",
"<em>Gastroenterology</em> (<em>acute</em> <em>and</em> <em>chronic</em>)",
"Haematology (<em>acute</em> <em>and</em> <em>chronic</em>)",
"Respiratory medicine (<em>acute</em> <em>and</em> <em>chronic</em>)"
],
And I am expecting:
{
"@search.score": 1.0405536,
"@search.highlights": {
"disciplines/services/translatedName": [
"<em>Gastroenterology (acute and chronic)</em>",
],
Am I doing something wrong?
I tried to cut main word to one-word like Gastroenterology but some of them simply cannot be cut.
Providing quotes like synonyms => "Gastroenterology (acute and chronic)"
also does not work.
UPDATED
I was wondering why I thought there is problem. Well, I provided:
{"name":"map",
"format":"solr",
"synonyms":"Gastroenterology (acute and chronic),vomiting, diarrhoea, weight loss\n"}
And actually using:
{"name":"map",
"format":"solr",
"synonyms":"Gastroenterology (acute and chronic),vomiting, diarrhoea, weight loss
=> Gastroenterology (acute and chronic)\n"}
In that case I vae 4 results:
"@odata.count": 4,
"value": [
{
"@search.score": 1.0137179,
"@search.highlights": {
"disciplines/services/translatedName": [
"<em>Acute</em> <em>and</em> <em>chronic</em> ear disease",
"<em>Acute</em> <em>and</em> <em>chronic</em> skin disease",
"<em>Gastroenterology</em> (<em>acute</em> <em>and</em> <em>chronic</em>)",
"Haematology (<em>acute</em> <em>and</em> <em>chronic</em>)",
"Respiratory medicine (<em>acute</em> <em>and</em> <em>chronic</em>)"
],
"equipment/translatedName": [
"Emergency <em>and</em> crictial care",
"In house skin <em>and</em> ear cyology"
],
"disciplines/translatedName": [
"Anaesthesia <em>and</em> analgesia",
"Emergency <em>and</em> critical care"
]
},
...
{
"@search.score": 0.33542877,
"@search.highlights": {
"disciplines/services/translatedName": [
"<em>Chronic</em> pain management"
],
"disciplines/translatedName": [
"Anaesthesia <em>and</em> analgesia"
]
},
...
{
"@search.score": 0.13757591,
"@search.highlights": {
"equipment/translatedName": [
"Emergency <em>and</em> crictial care"
],
"disciplines/translatedName": [
"Emergency <em>and</em> critical care"
]
},
...
{
"@search.score": 0.07112321,
"@search.highlights": {
"disciplines/services/translatedName": [
"<em>Chronic</em> pain management"
]
},
Could you explain to me how it works in that case?