OrchardCore
OrchardCore copied to clipboard
Lucene query parsing error when using terms filter
Describe the bug
I have a ContentType named Listing
, which has a text field called Type
. Type
can be "League", "Club", or "Event". I am trying to create a Lucene query and running into an issue filtering by Type
.
Query:
{
"query": {
"bool" : {
"must": {
"match_all": {}
},
"filter": [
{ "terms" : { "Listing.Type" : {{ e }} } }
]
}
},
"sort": [
{ "Content.ContentItem.ModifiedUtc": { "order": "desc" } },
{ "Content.ContentItem.CreatedUtc": { "order": "desc" } }
]
}
Input:
{ e: ["Event", "Club"] }
For some reason running the query produces a parsing error:
Invalid query : Unexpected character encountered while parsing value: C. Path 'query.bool.filter[0].terms['Listing.Type']', line 8, position 43.
How would you pass an array of options to a query like this?
Related discussion: https://github.com/OrchardCMS/OrchardCore/discussions/11943#discussion-4190829
Screenshots
