Remove Special Characters - Azure AI Search

Davis, Vincent 0 Reputation points
2024-03-15T15:21:59.13+00:00

To remove or ignore special characters in a search query for an Azure Cognitive Search index.

(Json) Query:

{

  "search": "*",

  "queryType": "semantic",

  "semanticConfiguration": "resource-semanticsv2",

  "captions": "extractive",

  "answers": "extractive|count-3",

  "queryLanguage": "en-US"

}

 

Result:

    "@search.score": 1,

      "id": "1198",

      "Name": "$$$Benson, Carl",

      "User_role": null,

      "Job_title": null,

      "Manager": null

 

wanting to remove $ and still displaying the Name?!

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.
1,350 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-03-18T19:39:11.26+00:00

    @Davis, Vincent , Based on my understanding of your scenario description, you may try using a custom analyzer at index time that removes or replaces special characters in your indexed fields. Tutorial: create a custom analyzer - Azure AI Search | Microsoft Learn.

    If you haven't tried this already, you may use a character filter that removes or replaces the "$"

    You may also use regex, something like this:  "search": "/\\$+Benson, Carl/"

    Kindly let us know how it goes I'll follow-up with you further.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.