Store edm.GeographyPointCollection in Azure Search using C#

40 views Asked by At

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

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?

0

There are 0 answers