enable azure search synonyms

0 votes

I'm trying to enable a synonym map to some fields using the following code:

public ActionResult ConfigFieldToUseSynonyn()
        {
            string searchServiceName = "xxx";
            string apiKey = "123123123123123123123123123";

            SearchServiceClient serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(apiKey));
            var index = serviceClient.Indexes.Get("produtos");

            index.Fields[2].SynonymMaps = new string[] { "marca-synonymmap" };
            index.Fields[7].SynonymMaps = new string[] { "marca-synonymmap" };

            serviceClient.Indexes.CreateOrUpdate(index, accessCondition: AccessCondition.IfNotChanged(index));

            return Content("OK");
        }


when I'm trying to find products using "dolve" it's not mapping to "dove". What am I missing?

Mar 1, 2022 in Azure by Edureka
• 13,620 points
286 views

1 answer to this question.

0 votes
The '@' in the synonymmap definition designates the string content as a literal, and the rule becomes dolve, douve => doven, with the "n" at the end. The query 'dolve' is rewritten to 'doven' by this synonym rule. If you delete the '@' prefix or the new line 'n' in the synonym definition, synonyms will operate as anticipated.
answered Mar 1, 2022 by Edureka
• 12,690 points

Related Questions In Azure

0 votes
1 answer

Can I create virtual machine without virtual network in Azure Resource Manager?

A VNet is used to provide the ...READ MORE

answered Mar 4, 2022 in Azure by Edureka
• 13,620 points
1,653 views
0 votes
1 answer
0 votes
1 answer

How to retrieve View definition on Synapse (Azure SQL DW)?

To authenticate with Azure SQL Database or ...READ MORE

answered Mar 4, 2022 in Azure by Edureka
• 13,620 points
1,182 views
0 votes
1 answer

Azure Search Synonym Maps not returning expected results

I figured out what was wrong. You ...READ MORE

answered Mar 8, 2022 in Azure by Edureka
• 13,620 points
560 views
0 votes
1 answer

TCP in Azure IoT Hub

The default Protocol Gateway samples are indeed ...READ MORE

answered Oct 11, 2018 in IoT (Internet of Things) by DataKing99
• 8,240 points
1,987 views
0 votes
1 answer

connecting to Power BI API using non-interactive authentication?

Try changing the resource URI: var result = ...READ MORE

answered Oct 30, 2018 in Power BI by Shubham
• 13,490 points
2,011 views
0 votes
1 answer

How to install C#

Hi @Akanksha, C# is a programming language ...READ MORE

answered Feb 28, 2019 in Others by Pratibha
• 3,690 points
687 views
0 votes
1 answer

Azure Search synonyms not reflecting in results

You most certainly should. If the words ...READ MORE

answered Mar 2, 2022 in Azure by Edureka
• 12,690 points
608 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP