Skip to content

Commit

Permalink
Format json document in test (#16983)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienros authored Nov 10, 2024
1 parent ebde3ec commit 86516ea
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions test/OrchardCore.Tests/Apis/Lucene/LuceneQueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,34 @@ public async Task TwoWildcardQueriesWithBoostHasResults()
// Should find articles with "Orchard" in the title
var index = "ArticleIndex";

// { "from": 0, "size": 10, "query":{ "bool": { "should": [ { "wildcard": { "Content.ContentItem.DisplayText.Normalized": { "value": "orch*", "boost": 2 } } },{ "wildcard": { "Content.BodyAspect.Body": { "value": "orchar*", "boost": 5 } } } ] } } }
var query =
"{ \"from\": 0, \"size\": 10, \"query\":" +
"{ \"bool\": { \"should\": [ " +
"{ \"wildcard\": { \"Content.ContentItem.DisplayText.Normalized\": { \"value\": \"orch*\", \"boost\": 2 } } }," +
"{ \"wildcard\": { \"Content.BodyAspect.Body\": { \"value\": \"orchar*\", \"boost\": 5 } } }" +
"] } } }";

var query = """
{
"from": 0,
"size": 10,
"query": {
"bool": {
"should": [
{
"wildcard": {
"Content.ContentItem.DisplayText.Normalized": {
"value": "orch*",
"boost": 2
}
}
},
{
"wildcard": {
"Content.BodyAspect.Body": {
"value": "orchar*",
"boost": 5
}
}
}
]
}
}
}
""";
var content = await context.Client.GetAsync($"api/lucene/content?indexName={index}&query={query}");
var queryResults = await content.Content.ReadAsAsync<LuceneQueryResults>();
var contentItems = queryResults.Items.Select(x => JObject.FromObject(x).Deserialize<ContentItem>());
Expand Down

0 comments on commit 86516ea

Please sign in to comment.