1

I’m building a bot backed by Azure Search, we defined a synonym map, added it to an existing index but when we search by terms that exist only as synonyms and not indexed, the search results are the same as before adding the synonym map, seems that the synonyms are being completely ignored.

Is there a way to check if the map is being taken into consideration and why my queries are not taking them into consideration?

  • Hi, could you share a sample query, the rule from the synonym map you believe should apply, and the document you expect the query to match? Thanks! – Yahnoosh Jan 22 '19 at 14:11
  • Hi @Yahnoosh, This is the map I've created: `{ "name":"topicmap", "format":"solr", "synonyms": " IoT, Internet of Things, Internet of Thing, iot, IOT => iot\n" }` And I have documents indexed with the term iot, however if I do a search by 'internet of things' the best score I get is 0.009135721 and if I search by IoT I get a score of 4. – danielamadei Jan 23 '19 at 15:35
  • I'm confused. First you reported synonyms are not being applied and documents that had a synonym were not being retrieved. Now your comment make it seems as the document is being retrieved but the scores are not as you'd expect. Please clarify your question and ideally show which documents were returned and which you'd expect to match. – Yahnoosh Jan 25 '19 at 16:35
  • Hi @Yahnoosh, My point is, if I query by "iot", I get results with a high score because the documents have this term. What I want is have similar results quering by the synonym I've created (internet of things) which should resolve to "iot" and I expect the score to be high however I'm getting the same score as I was getting before creating the synonym map and applying it to the field. – danielamadei Jan 26 '19 at 17:58
  • Hi @Yahnoosh, I belive I have found the issue. Seems to be related to the fact that my synonym has multiple words (internet of things). If I query using quotation marks (search="internet of things"), the synonym is applied. Is there anything I can do to avoid having to query using quotation marks for the synonym to be resolved? – danielamadei Jan 26 '19 at 18:01
  • 1
    By putting quotes around a set of terms you inform the query parser that you want them to be processed together what allows to match them against the terms in the synonym map. A similar question has been asked here: https://stackoverflow.com/questions/51200616/synonym-maps-in-azure-search-synonym-phrases – Yahnoosh Jan 30 '19 at 17:48

3 Answers3

0

Call /indexes/[your index name]?api-version=2017-11-11 endpoint to get the index definition and then check that the synonym map is attached to the proper field, which should look like this:

{
  "name": "[your field name]",
  "type": "Edm.String",
  "searchable": true,
  "filterable": false,
  "retrievable": true,
  "sortable": true,
  "facetable": false,
  "key": false,
  "indexAnalyzer": null,
  "searchAnalyzer": null,
  "analyzer": null,
  "synonymMaps": [
    "topicmap"
  ]
},

If topicmap is NOT there you should update your index definition by calling POST method of the same endpoint.

Georgi
  • 395
  • 3
  • 4
0

I added synonymmap field attribute to all fields in my index. We have to do this step while creating the index. This is working in my case.

0

I resolved the problem by adding synonymMaps field to all other related fields in the index. For eg., my index had locations field and i modified it like shown below: { "name": "locations", "type": "Collection(Edm.String)", "searchable": true, "filterable": true, "retrievable": true, "sortable": false, "facetable": false, "key": false, "indexAnalyzer": null, "searchAnalyzer": null, "analyzer": "en.lucene", "synonymMaps": [ "mysynonymmap" ] }

So you should add synonymmap to other fields also.