Azure-sdk-for-net: [BUG] Azure.Search.Documents v11.1.1 search sdk Deserialize a facets string 'looks like a date' into datetime

Created on 29 Oct 2020  路  3Comments  路  Source: Azure/azure-sdk-for-net

Describe the bug
We installed Azure.Search.Documents v11.1.1. When search result's facets returned contains a string like date time (i.e., "9.6",or "9-6") it will be parsed into a date-time instead of a string.

Expected behavior
What is the expected behavior?
The returned facets should return string value as it is.

Actual behavior (include Exception or Stack Trace)
What is the actual behavior?
The returned facets value returned as a date time

To Reproduce
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

1.
2.

Environment:

  • Name and version of the Library package used: [e.g. Azure.Storage.Blobs 12.2.0]

Azure.Search.Documents v11.1.1

  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): [e.g. Azure AppService or Windows 10 .NET Framework 4.8]

IIS web project with .NET 4.7.2

  • IDE and version : [e.g. Visual Studio 16.3]

See the attachment for what is returned from api v.s. what return from sdk. The 8th item's value is "9-6" and is parsed into a date time.

PS. Azure.Search.Documents v11.1.1 internally use system.text.json for facets de-serializing. But we do not have access to the default options and seems nothing could be done to change this behavior.

image
image

Client Search customer-reported needs-team-attention question

All 3 comments

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@tg-msft In the Track 1 SDK, I recall we had helper methods with a type parameter to convert facets to the desired type. Is there an equivalent in Track 2? Or is this a deeper problem, where STJ is making too many assumptions about the type of string data?

Thanks for reporting this. A fix should be in by next week's release.

Was this page helpful?
0 / 5 - 0 ratings