Skip to content

Commit 7c17a3c

Browse files
feat: added microsoft geo spatial converter
1 parent bf1904c commit 7c17a3c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Cogworks.AzureSearch/Cogworks.AzureSearch.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>
1313
<PackageReference Include="Azure.Search.Documents" Version="11.6.0" />
14+
<PackageReference Include="Microsoft.Azure.Core.Spatial" Version="1.1.0" />
1415
</ItemGroup>
1516

1617
<!-- Project Visibility -->

src/Cogworks.AzureSearch/Options/ClientOption.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using Azure.Core;
1+
using System.Text.Json;
2+
using Azure.Core;
23
using Azure.Core.Pipeline;
4+
using Azure.Core.Serialization;
35
using Azure.Search.Documents;
46

57
namespace Cogworks.AzureSearch.Options
@@ -27,7 +29,15 @@ public ClientOption(string serviceName, string credentials, string serviceUrlEnd
2729

2830
private static SearchClientOptions GetOptions(bool searchHeaders)
2931
{
30-
var clientOptions = new SearchClientOptions();
32+
var serializerOptions = new JsonSerializerOptions
33+
{
34+
Converters = { new MicrosoftSpatialGeoJsonConverter() },
35+
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
36+
};
37+
var clientOptions = new SearchClientOptions
38+
{
39+
Serializer = new JsonObjectSerializer(serializerOptions),
40+
};
3141

3242
if (searchHeaders)
3343
{

0 commit comments

Comments
 (0)