List of Escape Characters in Search Synonym Map

YYH 1 Reputation point
2021-06-14T08:02:24.843+00:00

I understand that we can use \ to help escape special strings in synonym maps such as comma and \ itself
But what are the full list of characters to escape?

Thank you

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
834 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 19,921 Reputation points
    2021-06-14T12:00:51.317+00:00

    Thanks for asking question! As its mentioned here: Synonyms in Azure Cognitive Search that-

    Synonyms are analyzed during query processing. If you need to define synonyms that contain commas or other special characters, you can escape them with a backslash, like in this example:

    {
    "format": "solr",
    "synonyms": "WA\, USA, WA, Washington\n"
    }

    Since the backslash is itself a special character in other languages like JSON and C#, you will probably need to double-escape it. For example, the JSON sent to the REST API for the above synonym map would look like this:

    {
    "format":"solr",
    "synonyms": "WA\, USA, WA, Washington"
    }

    If you are looking more on this? Let us know if further query on this.


  2. SnehaAgrawal-MSFT 19,921 Reputation points
    2021-06-18T05:51:17.083+00:00

    Thanks, special characters are + - & | ! ( ) { } [ ] ^ " ~ * ? : \ /

    Hope this helps. Further I will reach out to content author for updating this document. Thanks again.

    0 comments No comments