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 in Azure by Edureka
• 11,040 points
43 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 by Edureka
• 9,540 points

Related Questions In Azure

0 votes
1 answer
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 in Azure by Edureka
• 11,040 points
154 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 in Azure by Edureka
• 11,040 points
143 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,550 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
1,720 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
262 views
0 votes
1 answer

Azure Search synonyms not reflecting in results

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

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