Skip to content

Commit 02e201a

Browse files
[Search] Enhance 'FacetsArentAutomaticallyParsed` test (Azure#27237)
Add some more common "date-looking" strings and verify they are not automatically parsed as `DateTimeOffset`
1 parent 50f7c35 commit 02e201a

File tree

3 files changed

+164
-89
lines changed

3 files changed

+164
-89
lines changed

sdk/search/Azure.Search.Documents/tests/DocumentOperations/SearchTests.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,8 @@ await client.UploadDocumentsAsync(
684684
new FacetKeyValuePair("1", "9-6"),
685685
new FacetKeyValuePair("2", "9.6"),
686686
new FacetKeyValuePair("3", "9'6\""),
687+
new FacetKeyValuePair("4", "9/6"),
688+
new FacetKeyValuePair("5", "9\\6"),
687689
});
688690
await resources.WaitForIndexingAsync();
689691

@@ -694,13 +696,15 @@ await resources.GetQueryClient().SearchAsync<FacetKeyValuePair>(
694696

695697
Assert.IsNotNull(response.Value.Facets);
696698
AssertFacetsEqual(
697-
GetFacetsForField(response.Value.Facets, "Value", 3),
699+
GetFacetsForField(response.Value.Facets, "Value", 5),
698700
MakeValueFacet(1, "9'6\""),
699701
MakeValueFacet(1, "9-6"),
700-
MakeValueFacet(1, "9.6"));
702+
MakeValueFacet(1, "9.6"),
703+
MakeValueFacet(1, "9/6"),
704+
MakeValueFacet(1, "9\\6"));
701705

702706
// Check strongly typed value facets
703-
ICollection<FacetResult> facets = GetFacetsForField(response.Value.Facets, "Value", 3);
707+
ICollection<FacetResult> facets = GetFacetsForField(response.Value.Facets, "Value", 5);
704708
ValueFacetResult<string> first = facets.ElementAt(0).AsValueFacetResult<string>();
705709
Assert.AreEqual("9'6\"", first.Value);
706710
Assert.AreEqual(1, first.Count);
@@ -710,6 +714,12 @@ await resources.GetQueryClient().SearchAsync<FacetKeyValuePair>(
710714
ValueFacetResult<string> third = facets.ElementAt(2).AsValueFacetResult<string>();
711715
Assert.AreEqual("9.6", third.Value);
712716
Assert.AreEqual(1, third.Count);
717+
ValueFacetResult<string> fourth = facets.ElementAt(3).AsValueFacetResult<string>();
718+
Assert.AreEqual("9/6", fourth.Value);
719+
Assert.AreEqual(1, fourth.Count);
720+
ValueFacetResult<string> fifth = facets.ElementAt(4).AsValueFacetResult<string>();
721+
Assert.AreEqual("9\\6", fifth.Value);
722+
Assert.AreEqual(1, fifth.Count);
713723
}
714724

715725
[Test]

sdk/search/Azure.Search.Documents/tests/SessionRecords/SearchTests/FacetsArentAutomaticallyParsed.json

Lines changed: 76 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)