I have successfully created and populated a location field in Azure Search ... but cannot get the correct serializer / c# type for edm.GeographyPointCollection
using Azure.Core.Serialization;
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Indexes.Models;
using Microsoft.Spatial;
using System.Text.Json.Serialization;
...
[JsonConverter(typeof(MicrosoftSpatialGeoJsonConverter))]
[JsonPropertyName("location")]
[SimpleField(IsFilterable = true, IsSortable = true)]
public GeographyPoint? Location { get; set; }
?????
public List<GeographyPoint> ?????? Locations { get; set; }
...
The converter appears to have been fixed in October 2021, but the version available on NuGet was published in June 2021
- What C# type should I use to map to edm.GeographyPointCollection (Microsoft learn does not say)?
- How do I make this work with the JsonConverter?
- The beta release only has a writer for GeographyPoint ... this is not the same version as the current code in github
The answer at Azure Search - Query Collection of GeographyPoint uses a workaround by having a property with a child collection of GeographyPoint. How do I map to the GeographyPointCollection directly, or is the workaround the only viable way to do this?