Filter for empty Structured Text field?

I have a Blog Post model with a body field that contains structured text. Translation is enabled on the body field.

My issue is I can’t figure out how to query for Blog Posts that have actually been populated with content (not all posts are translated, and not all languages have a translation for every post). Even for languages I have populated no content for, the value of the field is:

“body”: {
“value”: {
“schema”: “dast”,
“document”: {
“type”: “root”,
“children”: [
{
“type”: “paragraph”,
“children”: [
{
“type”: “span”,
“value”: “”
}
]
}
]
}
}
},

Any suggestions?

hi @kaushik I think you are right. It might be a bug. Let me check this with the team!

Trying to work around this. I can’t seem to get matches to work as an alternative.

  allBlogPosts(filter: {body: {exists: "true",  matches: "\{\"type\":\"root\",\"children\":\[\{\"type\":\"paragraph\",\"children\":\[{\"type\":\"span\",\"value\":\"\"\}\]\}\]\}"}}, locale: fr) {
id
body {
  value
}
  }
}

throws this:

    {
  "errors": [
    {
      "message": "Parse error on \"\\\"\" (error) at [1, 64]",
      "locations": [
        {
          "line": 1,
          "column": 64
        }
      ]
    }
  ]
}

But I’m not sure why.

I’m not sure if you can filter on a property of the content. You should filter on the value of it, but I cannot find a way to do that, sorry.

We’ll be in touch about a proper way to solve this, sorry

Hi @kaushik, we just added a new filter for this called isBlank:

{
  allBlogPosts(filter: {body: {isBlank: false}}) {
    ...
  }
}