OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

Lucene query parsing error when using terms filter

Open scottiemc7 opened this issue 2 years ago • 0 comments

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

Screen Shot 2022-09-16 at 5 16 19 PM

scottiemc7 avatar Sep 17 '22 00:09 scottiemc7