MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10k stars 21k forks source link

Upgrading from Microsoft.Azure.Search v10 to Azure.Search.Documents v11 #122254

Open vishalwakad opened 1 week ago

vishalwakad commented 1 week ago

According to https://learn.microsoft.com/en-us/azure/search/search-dotnet-sdk-migration-version-11#UpgradeSteps document I have made the changes for Conflict search up to step 8 . Currently I am working on updating classes, methods, and properties to use the APIs of the new library and finding equivalent APIs.

I want to upgrade the following code of version Microsft.Azure.Search v10

var scoringPars = new List(); var tennantConfig = await configManager.GetConfiguation(applicationSettings.UniqueOrganizationName); scoringPars.Add(new ScoringParameter("owners", new[] { currentUser.SystemUserID }));

var parameters = new SearchParameters { IncludeTotalResultCount = true, QueryType = QueryType.Full, SearchMode = SearchMode.All, ScoringParameters = scoringPars, };

The changes that I made while upgrading to Azure.Search.Documents is

var scoringPars = new List(); var tennantConfig = await configManager.GetConfiguation(applicationSettings.UniqueOrganizationName); scoringPars.Add(new TagScoringParameters("owners"));

var parameters = new SearchOptions { SearchMode = SearchMode.All, IncludeTotalCount = true,
QueryType = SearchQueryType.Full, ScoringParameters = scoringPars };

I am getting error in following line

 ScoringParameters = scoringPars

Also I would like to know that is there any document or any ink available that can help us find equivalent APIS of Microsoft.Azure.Search in to Azure.Search.Documents.

Or if someone has done it earlier migrated from Microsoft.Azure.Search in to Azure.Search.Documents. Is there any standard way to reduce time and manual effort to upgarde apis which is quite time consuming as just adding new referenced wont help. We have to find matching apis and classes etc from the documents and modify them in code.

### Tasks

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

TPavanBalaji commented 1 week ago

@vishalwakad Thank you for bringing this to our attention. I've delegated this to content author, who will review it and offer their insightful opinions.

HeidiSteen commented 1 week ago

Hi @vishalwakad, I'm sorry about the frustration on upgrade, I agree it's time consuming. The only information we have on upgrade is in the document you found. I looked for C# scoring profiles in various samples, and it looks like we could use some more. I'll add it to the backlog. In the meantime, I found a partial example in the SDK tests: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/tests/SearchIndexClientTests.cs It's not what you're looking for, but the test cases call all of the APIs and sometimes it's better than nothing.

@mattgotteiner, can you look at the scoringParameters definition and see if anything jumps out?