Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.47k stars 4.8k forks source link

[Azure Cognitive Search] Need sample showing explicit Field construction #9472

Closed chadbr closed 4 years ago

chadbr commented 4 years ago

A couple of years back - the index definitions changed to use attributes: https://github.com/Azure/azure-sdk-for-net/issues/2427

Is there a sample of doing it 'the old way'?

I have models from source code I don't control... I need to build indexes on them. Is there a sample of how to do this without having to rebuild the models with search / index attributes?

chadbr commented 4 years ago

I found a sample by digging through the sdk sample git history...

https://github.com/Azure-Samples/search-dotnet-getting-started/blob/153049a996fa88a0f0e5b17ff342088043d944fd/DotNetSample/DataIndexer/Program.cs

I think it would be valuable to have a sample like this in current sdk? Or am I swimming upstream on this one?

Thanks, Chad

brjohnstmsft commented 4 years ago

Hi Chad,

There's no sample of building fields explicitly, but there is test code that you can look at: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexFixture.cs

Let me know if that helps.

chadbr commented 4 years ago

That does help. But I still feel like it needs to be in the samples?

brjohnstmsft commented 4 years ago

@chadbr We'll be revisiting samples this year while we update our .NET SDK to meet the new Azure API Guidelines. I'll leave this issue open to track the explicit Field construction case for the new samples.

chadbr commented 4 years ago

Thank you -- Regards, Chad